/* *****************************************************************************
 * Copyright (c) Huawei Technologies Co., Ltd. 2019. All rights reserved.
 ******************************************************************************
  File Name     : sml_table.h
  Version       : Initial Draft
  Created       : 2019/1/9
  Last Modified :
  Description   : SML table definition
  Function List :
  History       :
  1.Date        : 2019/1/9
    Modification: Created file
***************************************************************************** */
#ifndef SML_TABLE_H
#define SML_TABLE_H

#include "sml_table_pub.h"
#include "typedef.h"

#define SML_IPV6_LEN 4 /* 16byte：4 * U32 */

typedef struct tag_log_ctrl {
#if (BYTE_ORDER == BIG_ENDIAN)
    u32 mod_name : 4;
    u32 log_level : 4;
    u32 rsvd : 8;
    u32 line_num : 16;
#else
    u32 line_num : 16;
    u32 rsvd : 8;
    u32 log_level : 4;
    u32 mod_name : 4;
#endif
} log_ctrl;

/**
 * Struct name:    sml_glb_tbl_com_s
 * @brief global_table structure type
 * Description: global configuration table
 */
typedef struct tag_sml_glb_tbl_com_s {
    /* enable and valid flag */
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 master_host_id : 3;
            u32 master_func_id : 5;
            u32 hot_update_active_flag : 1;      /* hot update flag:0-activating;1-activated */
            u32 local_switch_en : 1;    /* Local switching enable bit in the container scenario. */
            u32 err_smac_check_off : 1; /* smac error packets, check_off enable (1), not drop,if 0,drop */
            u32 ipcs_err_rss_en : 1;    /* IP checksum error packets, enable rss quadruple hash flag. */
            u32 lldp_fwd_en : 4;        /* lldp forward enable(4 port) */
            u32 lacp_fwd_en : 4;        /* lacp forward enable(4 port) */
            u32 virtio_idesc_size : 6;
            u32 flex_en : 1;
            u32 special_pro_to_up_flag : 1; /* 1-special protocal pkt to up; 0-to x86 */
            u32 l2nic_lb_md : 2;            /* 2'b00 - NO load balance;
                                             * 2'b01 - load balance based on queue id[0](load balance @ 2 SMF);
                                             * 2'b10 - load balance based on queue id[1:0](load balance @ 4 SMF);
                                             */
            u32 lbf_mode : 2;               /* 0:disable;1:simple hash0(vf);2:simple hash1(qid);3:hash key */

#else
            u32 lbf_mode : 2; /* 0:disable;1:simple hash0(vf);2:simple hash1(qid);3:hash key */
            u32 l2nic_lb_md : 2;
            u32 special_pro_to_up_flag : 1; /* 1-special protocal pkt to up; 0-to x86 */
            u32 flex_en : 1;
            u32 virtio_idesc_size : 6;
            u32 lacp_fwd_en : 4;        /* lacp forward enable(4 port) */
            u32 lldp_fwd_en : 4;        /* lldp forward enable(4 port) */
            u32 ipcs_err_rss_en : 1;    /* IP checksum error packets, enable rss quadruple hash flag. */
            u32 err_smac_check_off : 1; /* smac error packets, check_off enable (1), not drop,if 0,drop */
            u32 local_switch_en : 1;    /* Local switching enable bit in the container scenario. */
            u32 hot_update_active_flag : 1;      /* hot update flag:0-hotupdate;1-hotupdateend */
            u32 master_func_id : 5;
            u32 master_host_id : 3;
#endif
        } bs;
        u32 value;
    } dw0;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 nic_id : 20;  /* only nic id */
            u32 tso_mode : 1; /* 0:tso space used by software;1:L2NIC engine use tso space */
            u32 map_port_offset : 4;
            u32 tso_space_size : 4;
            u32 rsvd : 3;
#else
            u32 rsvd : 3;
            u32 tso_space_size : 4;
            u32 map_port_offset : 4;
            u32 tso_mode : 1; /* 0:tso space used by software;1:L2NIC engine use tso space */
            u32 nic_id : 20;
#endif
        } bs;
        u32 value;
    } dw1;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 storage_start_vf_id : 12; /* storage type virtio device start vf id£¨blk/scsi) */
            u32 lro_space_size : 4;
            u32 rsvd : 2;
            u32 l2nic_total_qps : 14;
#else
            u32 l2nic_total_qps : 14;
            u32 rsvd : 2;
            u32 lro_space_size : 4;
            u32 storage_start_vf_id : 12; /* storage type virtio device start vf id£¨blk/scsi) */

#endif
        } bs;
        u32 value;
    } dw2;

    u8 mac_port_map[8]; /* index: mac port id, value: real port id. */
    u8 sml_id[4];

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsvd : 3;
            u32 port_speed : 8;
            u32 storage_multi_host : 1;
            u32 storage_env : 1;
            u32 port_num : 3;
            u32 host_num : 3;
            u32 port_mask : 2;
            u32 host_mask : 2;
            u32 port_shift : 2;
            u32 host_shift : 2;
            u32 master_func : 5;
#else
            u32 master_func : 5;
            u32 host_shift : 2;
            u32 port_shift : 2;
            u32 host_mask : 2;
            u32 port_mask : 2;
            u32 host_num : 3;
            u32 port_num : 3;
            u32 storage_env : 1;
            u32 storage_multi_host : 1;
            u32 port_speed : 8;
            u32 rsvd : 3;
#endif
        } bs;
        u32 value;
    } dw6;
    u8 aa_lt_inst_id[4];
    u8 aa_ht_inst_id[4];
    u32 roce_tbl[6]; /* Reuse with roce_tbl. roce_tbl is only initialized and used in NPU. */

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 roce_tbl_byte_24 : 8; /* roce_tbl[24], second last byte of roce_tbl, only use in NPU */
            u32 roce_tbl_byte_25 : 8; /* roce_tbl[25], last byte of roce_tbl, only use in NPU */
            u32 virtio_net_rq_ctrl_cos : 3;
            u32 virtio_net_sq_cos : 3;
            u32 virtio_storage_cos : 3;
            u32 ncsi_arp_en : 4;
            u32 rsvd : 3;
#else
            u32 rsvd : 3;
            u32 ncsi_arp_en : 4;
            u32 virtio_storage_cos : 3;
            u32 virtio_net_sq_cos : 3;
            u32 virtio_net_rq_ctrl_cos : 3;
            u32 roce_tbl_byte_25 : 8; /* roce_tbl[25], last byte of roce_tbl */
            u32 roce_tbl_byte_24 : 8; /* roce_tbl[24], second last byte of roce_tbl */
#endif
        } bs;
        u32 value;
    } dw15;
} sml_glb_tbl_com_s;

/**
 * Struct name:    sml_glb_tbl_ovs_s
 * Structure type of the @brief microcode ovs part information
 * Data structure of the index 16 table in the Description: global configuration table
 */
typedef struct tag_sml_glb_tbl_ovs {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 ovs_flow_flush_en : 1;
            u32 ovs_forward_mode : 8;
            u32 base_pf_id : 5;
            u32 base_qpc_func : 12;
            u32 qpc_pf_num : 6;
#else
            u32 qpc_pf_num : 6;
            u32 base_qpc_func : 12;
            u32 base_pf_id : 5;
            u32 ovs_forward_mode : 8;
            u32 ovs_flow_flush_en : 1;
#endif
        } bs;
        u32 value;
    } dw0;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 flow_table_aging_time : 16;
            u32 prefix_mac : 16;
#else
            u32 prefix_mac : 16;
            u32 flow_table_aging_time : 16;
#endif
        } bs;
        u32 value;
    } dw1;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 ip_frag_upcall_limit_en : 1;
            u32 ovs_etp_en : 2;
            u32 ovs_flow_unage_en : 1;
            u32 ovs_mega_flow_en : 1;
            u32 ovs_fm_glb_thrd_en : 1;
            u32 ovs_fm_glb_rule_en : 1;
            u32 ovs_fm_glb_period_en : 1;
            u32 ovs_vxlan_check_upcall : 1;
            u32 host_id : 3;
            u32 ppf_id : 6;
            u32 bond_hash_policy : 3;
            u32 bond_mode : 3;
            u32 bond_id : 3;
            u32 mc_offload_en : 1;
            u32 bond_hash_policy_en : 1; /* when disabled, ovs bond hash by vfid ^ sqn */
            u32 acl_en : 1;
            u32 dp_hash_en : 1;
            u32 dp_hash_flush_en : 1;
#else
            u32 dp_hash_flush_en : 1;
            u32 dp_hash_en : 1;
            u32 acl_en : 1;
            u32 bond_hash_policy_en : 1;
            u32 mc_offload_en : 1;
            u32 bond_id : 3;
            u32 bond_mode : 3;
            u32 bond_hash_policy : 3;
            u32 ppf_id : 6;
            u32 host_id : 3;
            u32 ovs_vxlan_check_upcall : 1;
            u32 ovs_fm_glb_period_en : 1;
            u32 ovs_fm_glb_rule_en : 1;
            u32 ovs_fm_glb_thrd_en : 1;
            u32 ovs_mega_flow_en : 1;
            u32 ovs_flow_unage_en : 1;
            u32 ovs_etp_en : 2;
            u32 ip_frag_upcall_limit_en : 1;
#endif
        } bs;
        u32 value;
    } dw2;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 qpc_cache_start : 12;
            u32 qpc_cache_end : 12;
            u32 qpc_bsize : 2;
            u32 rsvd1 : 6;
#else
            u32 rsvd1 : 6;
            u32 qpc_bsize : 2;
            u32 qpc_cache_end : 12;
            u32 qpc_cache_start : 12;
#endif
        } bs;
        u32 value;
    } dw3;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 timer_cache_start : 12;
            u32 timer_cache_end : 12;
            u32 timer_bsize : 2;
            u32 rsvd1 : 6;

#else
            u32 rsvd1 : 6;
            u32 timer_bsize : 2;
            u32 timer_cache_end : 12;
            u32 timer_cache_start : 12;
#endif
        } bs;
        u32 value;
    } dw4;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 upcall_pri_protocol_bmp : 8;
            u32 upcall_pri_q_num : 5;
            u32 latency_mode : 1;
            u32 rsvd1 : 18;
#else
            u32 rsvd1 : 18;
            u32 latency_mode : 1;
            u32 upcall_pri_q_num : 5;
            u32 upcall_pri_protocol_bmp : 8;
#endif
        } bs;
        u32 value;
    } dw5;

    s32 mirror_session_ref_cnt;
    u32 rsvd[9];
} sml_glb_tbl_ovs_s;

/**
 * Struct name:    sml_glb_tbl_ppa_s
 * Structure type of the @brief microcode ppa part information
 * Data structure of the index 18 table in the Description: global configuration table
 */
typedef struct tag_sml_glb_tbl_ppa {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 ppa_mode_type : 2; /* 0 : XG, 1 : HG , 2 : TELIGEN */
            u32 base_qpc_func : 13;
            u32 qpc_pf_num : 6;
            u32 ppf_id : 6;
            u32 host_id : 2;
            u32 ppa_flow_flush_en : 1; /* 0 : ppa flush disable, 1: ppa flush enable */
            u32 rsv : 2;
#else
            u32 rsv : 2;
            u32 ppa_flow_flush_en : 1; /* 0 : ppa flush disable, 1: ppa flush enable */
            u32 host_id : 2;
            u32 ppf_id : 6;
            u32 qpc_pf_num : 6;
            u32 base_qpc_func : 13;
            u32 ppa_mode_type : 2; /* 0 : XG, 1 : HG , 2 : TELIGEN */
#endif
        } bs;
        u32 value;
    } dw0;

    u32 ppa_hash_table_mask;

    u32 ppa_tcam_table_mask;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 bfilter_start_addr : 16;
            u32 bfilter_length : 16;
#else
            u32 bfilter_length : 16;
            u32 bfilter_start_addr : 16;
#endif
        } bs;
        u32 value;
    } dw1;
    u32 rsvd[12];
} sml_glb_tbl_ppa_s;

/**
 * Struct name:    sml_glb_tbl_toe_cfg_s
 * Structure type of the @brief microcode toe config information
 * Data structure of the index 24 table in the Description: global configuration table
 */
typedef struct tag_sml_glb_tbl_toe_cfg {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 srq_mgr_cl_start : 10;
            u32 srq_mgr_cl_end : 10;
            u32 rsvd : 12;
#else
            u32 rsvd : 12;
            u32 srq_mgr_cl_end : 10;
            u32 srq_mgr_cl_start : 10;
#endif
        } bs;
        u32 value;
    } dw0;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 wqe_cl_start : 10;
            u32 wqe_cl_end : 10;
            u32 rsvd : 12;
#else
            u32 rsvd : 12;
            u32 wqe_cl_end : 10;
            u32 wqe_cl_start : 10;
#endif
        } bs;
        u32 value;
    } dw1;

    u32 rsvd[14];
} sml_glb_tbl_toe_cfg_s;

/**
 * Struct name:    sml_glb_tbl_ucode_version_s
 * Structure type of the @brief microcode version information
 * Data structure of the index 1 table in the Description: global configuration table
 */
typedef struct tag_sml_glb_tbl_ucode_version {
    u32 ucode_version[4];
    u32 ucode_compile_time[5];
    u32 rsvd[7];
} sml_glb_tbl_ucode_version_s;

/*
1.bank GPA addresses are divided based on hosts. Each host4 address has a total of 4*32B bank GPA addresses.

2. Storage space allocation
Two global entry are allocated to store bank GPA, which are index5 and index6 respectively. (The start value of is 0.)
The 32B of the index5 stores the bank GPA of the host 0, and the 32B of the stores the bank GPA of the host 1.
The 32B of the index6 stores the bank GPA of the host 2, and the 32B of the stores the bank GPA of the host 3.
(The bank GPA data structure corresponding to each host is stored in the following format.)
*/
typedef struct tag_sml_glb_tbl_bank_gpa {
    u32 bank0_gpa_h32;
    u32 bank0_gpa_l32;

    u32 bank1_gpa_h32;
    u32 bank1_gpa_l32;

    u32 bank2_gpa_h32;
    u32 bank2_gpa_l32;

    u32 bank3_gpa_h32;
    u32 bank3_gpa_l32;

    u32 ppf_id;
    u32 rsvd[7];
} sml_glb_tbl_bank_gpa_s;

/**
 * Struct name:    sml_funcfg_tbl_s
 * @brief          Function Configuration Table
 * Description: Function configuration attribute table
                dw0-dw7   public&nic&crypto
                dw8-dw11  ovs&ppa&vbs
                dw12-dw15 roce&toe&virtio
 */
typedef struct tag_sml_funcfg_tbl {
    /* valid and enable flag */
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 valid : 1; /* function valid: 0-invalid; 1-valid */
            u32 virtio_en : 1;
            u32 ipsec_mode : 2;  /* IPsec offload mode: 0-disable; 1-xfrm offload; 2-hw offload */
            u32 ovs_func_en : 1; /* ovs function enable: 0-disable; 1-enable */
            u32 roce_en : 1;
            u32 toe_en : 1;
            u32 drop_en : 1;  /* Packet loss enable. This bit is used to discard packets when valid bit = 1 in the
                                 function table is used. The solution to DCB dynamic configuration is extended. */
            u32 learn_en : 1; /* mac learn enable: 0-disable; 1-enable */
            u32 nic_spoofchk_en : 1;
            u32 rss_en : 1;            /* rss enable: 0-disable; 1-enable */
            u32 rxvlan_offload_en : 1; /* rx vlan offload enable: 0-disable; 1-enable */
            u32 vlan_filter_en : 1;
            u32 lro_change : 1;
            u32 lro_ipv4_en : 1; /* IPv4 LRO enable: 0-disable; 1-enable; */
            u32 lro_ipv6_en : 1; /* IPv6 LRO enable: 0-disable; 1-enable; */
            u32 icq_vld : 1;
            u32 icq_mask : 5;
            u32 unicast_mac_num : 2;
            u32 lro_max_len : 8;
#else
            u32 lro_max_len : 8;
            u32 unicast_mac_num : 2;
            u32 icq_mask : 5;
            u32 icq_vld : 1;
            u32 lro_ipv6_en : 1; /* IPv6 LRO enable: 0-disable; 1-enable; */
            u32 lro_ipv4_en : 1; /* IPv4 LRO enable: 0-disable; 1-enable; */
            u32 lro_change : 1;
            u32 vlan_filter_en : 1;
            u32 rxvlan_offload_en : 1; /* rx vlan offload enable: 0-disable; 1-enable */
            u32 rss_en : 1;            /* rss enable: 0-disable; 1-enable */
            u32 nic_spoofchk_en : 1;
            u32 learn_en : 1; /* mac learn enable: 0-disable; 1-enable */
                              /* function table is used. The solution to DCB dynamic configuration is extended. */
            u32 drop_en : 1;  /* Packet loss enable. This bit is used to discard packets when valid bit = 1 in the */
            u32 toe_en : 1;
            u32 roce_en : 1;
            u32 ovs_func_en : 1; /* ovs function enable: 0-disable; 1-enable */
            u32 ipsec_mode : 2;  /* IPsec offload mode: 0-disable; 1-xfrm offload; 2-hw offload */
            u32 virtio_en : 1;
            u32 valid : 1;         /* function valid: 0-invalid; 1-valid */
#endif
        } bs;

        u32 value;
    } dw0;

    /* common config */
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 host_id : 3;        /* host id: [0~3]. support up to 4 Host. */
            u32 mtu : 14;           /* mtu value: [64-15500] */
            u32 vlan_mode : 1;      /* vlan mode: 0-normal filter; 1-qinq filter; */
            u32 msix_occupied : 1;  /* msix occupied: 0-not alloc msix for queue; 1-alloced msix for queue; */
            u32 mig_mgmt_valid : 1; /* migrate managment valid: 0-invalid; 1-valid */
            u32 vlan_id : 12;       /* vlan id: [0~4095] */
#else
            u32 vlan_id : 12;       /* vlan id: [0~4095] */
            u32 mig_mgmt_valid : 1; /* migrate managment valid: 0-invalid; 1-valid */
            u32 msix_occupied : 1;  /* msix occupied: 0-not alloc msix for queue; 1-alloced msix for queue; */
            u32 vlan_mode : 1;      /* vlan mode: 0-normal filter; 1-qinq filter; */
            u32 mtu : 14;           /* mtu value: [64-15500] */
            u32 host_id : 3;        /* host id: [0~3]. support up to 4 Host. */

#endif
        } bs;

        u32 value;
    } dw1;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 nic_rx_mode : 5; /* nic_rx_mode: 0b00001: unicast mode
                                            0b00010: multicast mode
                                            0b00100: BC mode
                                            0b01000: all multicast mode
                                            0b10000: promisc mode */
            u32 def_pri : 3;     /* default priority */
            u32 er_id : 4;       /* edge relay id: [0~15]. support up to 16 er. */
            u32 er_fwd_type : 4; /* er forward type: 2-port; 3-fic; 4-trunk; other-unsupport  */
            u32 er_fwd_id : 3;  /* er forward id: fwd_type=2: forward ethernet port id
                                                   fwd_type=3: forward fic id(tb+tp)
                                                   fwd_type=4: forward trunk id */
            u32 cfg_rq_num : 9;
            u32 local_switch_lro_en : 1;
            u32 bond_bifur_en : 1;
            u32 flow_bifur_en : 1;
            u32 os_hotreplace_en : 1;
#else
            u32 os_hotreplace_en : 1;
            u32 flow_bifur_en : 1;
            u32 bond_bifur_en : 1;
            u32 local_switch_lro_en : 1;
            u32 cfg_rq_num : 9;
            u32 er_fwd_id : 3;
            u32 er_fwd_type : 4; /* er forward type: 2-port; 3-fic; 4-trunk; other-unsupport  */
            u32 er_id : 4;       /* edge relay id: [0~15]. support up to 16 er. */
            u32 def_pri : 3;     /* default priority */
            u32 nic_rx_mode : 5;

#endif
        } bs;

        u32 value;
    } dw2;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 cfg_sq_num : 9;
            u32 rss_temp_id : 12;
            u32 rss_instance_id : 6;
            u32 rss_node_id : 5;

#else
            u32 rss_node_id : 5;
            u32 rss_instance_id : 6;
            u32 rss_temp_id : 12;
            u32 cfg_sq_num : 9;

#endif
        } bs;

        u32 value;
    } dw3;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rx_wqe_buffer_size : 16; /* one wqe buffer size, default is 2K bytes */
            u32 smac_h16 : 16;
#else
            u32 smac_h16 : 16;
            u32 rx_wqe_buffer_size : 16; /* one wqe buffer size, default is 2K bytes */
#endif
        } bs;

        u32 value;
    } dw4;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u16 smac_m16;
            u16 smac_l16;
#else
            u16 smac_l16;
            u16 smac_m16;
#endif
        } bs;
        u32 smac_l32;
    } dw5;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 vlan_pri_map_group : 24; /* every group takes 3bits,8 group totally 24bits, group 0 mapped to the lowest
                                            3bits */
            u32 cfg_rq_depth : 5;
            u32 round_bit : 1;
            u32 fdir_tcam_enable : 1;
            u32 rsvd : 1;

#else
            u32 rsvd : 1;
            u32 fdir_tcam_enable : 1;
            u32 round_bit : 1;
            u32 cfg_rq_depth : 5;
            u32 vlan_pri_map_group : 24; /* every group takes 3bits,8 group totally 24bits, group 0 mapped to the lowest
                                            3bits */

#endif
        } bs;

        u32 value;
    } dw6;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 bond_en : 1;
            u32 bond_id : 3;
            u32 bond_mode : 3;
            u32 bond_hash_policy : 3;
            u32 bond_active_num  : 3; /* use in flow bifurcation bond send */
            u32 bond_active_bitmap : 4; /* use in flow bifurcation bond send */
            u32 base_qid : 13;
            u32 rq_pri_num : 2;
#else
            u32 rq_pri_num : 2;
            u32 base_qid : 13;
            u32 bond_active_bitmap : 4; /* use in flow bifurcation bond send */
            u32 bond_active_num  : 3; /* use in flow bifurcation bond send */
            u32 bond_hash_policy : 3;
            u32 bond_mode : 3;
            u32 bond_id : 3;
            u32 bond_en : 1;
#endif
        } bs;
        u32 value;
    } dw7;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 ovs_vm_tx_bw_en : 1;
            u32 ovs_vm_tx_pps_en : 1;
            u32 ovs_vm_rx_bw_en : 1;
            u32 ovs_vm_rx_pps_en : 1;
            u32 ovs_mc_bc_limit_en : 1;       /* mc bc limit enable: 0-disable; 1-enable */
            u32 ovs_bum_limit_mode : 1;       /* flow type controled by bum limit: 0-mc and bc; 1-bc */
            u32 ovs_ethtype_filter_en : 1;    /* ethtype filter enable: 0-disable; 1-enable */
            u32 ovs_mac_filter_mode : 2;      /* mac filter mode: 0-disable; 1-single enable;2-multi enbale;3-rsvd */
            u32 ovs_upcall_limit_port_en : 1; /* per port upcall rate limit */
            u32 ovs_etp_en : 2;
            u32 ovs_capture_bond_en : 1;
            u32 ovs_capture_tap_en : 1;
            u32 ovs_trunk_port_en : 1;
            u32 ovs_vsmall_en : 1;
            u32 ovs_xtrace_en : 1;
            u32 icq_base : 12;
            u32 ovs_fm_period_en : 1;
            u32 ovs_vport_en : 1;
            u32 rsvd : 1;
#else
            u32 rsvd : 1;
            u32 ovs_vport_en : 1;
            u32 ovs_fm_period_en : 1;
            u32 icq_base : 12;
            u32 ovs_xtrace_en : 1;
            u32 ovs_vsmall_en : 1;
            u32 ovs_trunk_port_en : 1;
            u32 ovs_capture_tap_en : 1;
            u32 ovs_capture_bond_en : 1;
            u32 ovs_etp_en : 2;
            u32 ovs_upcall_limit_port_en : 1; /* per port upcall rate limit */
            u32 ovs_mac_filter_mode : 2;      /* mac filter mode: 0-disable; 1-single enable;2-multi enbale;3-rsvd */
            u32 ovs_ethtype_filter_en : 1;    /* ethtype filter enable: 0-disable; 1-enable */
            u32 ovs_bum_limit_mode : 1;       /* flow type controled by bum limit: 0-mc and bc; 1-bc */
            u32 ovs_mc_bc_limit_en : 1;       /* mc bc limit enable: 0-disable; 1-enable */
            u32 ovs_vm_rx_pps_en : 1;
            u32 ovs_vm_rx_bw_en : 1;
            u32 ovs_vm_tx_pps_en : 1;
            u32 ovs_vm_tx_bw_en : 1;
#endif
        } ovs_bs;

        u32 value;
    } dw8;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 upcall_q_num : 5;
            u32 ovs_etp_index : 6;
            u32 ovs_xtrace_id : 6;
            u32 ovs_set_mac_flag : 1;
            u32 func_rss_type_en : 1; /* ovs_bs&bs consistent */
            u32 rss_type : 8;         /* ovs_bs&bs consistent */
            u32 dirty_set_en : 1;     /* ovs_bs&vbs_bs&bs consistent */
            u32 dirty_set_pf_id : 4;  /* ovs_bs&vbs_bs&bs consistent */
#else
            u32 dirty_set_pf_id : 4;
            u32 dirty_set_en : 1;
            u32 rss_type : 8;
            u32 func_rss_type_en : 1;
            u32 ovs_set_mac_flag : 1;
            u32 ovs_xtrace_id : 6;
            u32 ovs_etp_index : 6;
            u32 upcall_q_num : 5;
#endif
        } ovs_bs;

        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 flr_seq : 5;
            u32 stop_flag : 2;
            u32 func_state : 1;      /* used for sdi vsock pf */
            u32 dirty_set_en : 1;    /* ovs_bs&vbs_bs&bs consistent */
            u32 rsvd0 : 19;
            u32 dirty_set_pf_id : 4; /* ovs_bs&vbs_bs&bs consistent */
#else
            u32 dirty_set_pf_id : 4;
            u32 rsvd0 : 19;
            u32 dirty_set_en : 1;
            u32 func_state : 1;      /* used for sdi vsock pf */
            u32 stop_flag : 2;
            u32 flr_seq : 5;
#endif
        } vbs_bs;

        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsvd0 : 5;
            u32 outband_vlan_cfg_en : 1; /* used for nic only, this field unreliable on ovs/vbs func */
            u32 outband_default_vid : 12; /* valid only when outband_vlan_cfg_en == 1 */
            u32 func_rss_type_en : 1;
            u32 rss_type : 8;
            u32 dirty_set_en : 1;    /* ovs_bs&vbs_bs&bs consistent */
            u32 dirty_set_pf_id : 4; /* ovs_bs&vbs_bs&bs consistent */
#else
            u32 dirty_set_pf_id : 4;
            u32 dirty_set_en : 1;
            u32 rss_type : 8;
            u32 func_rss_type_en : 1;
            u32 outband_default_vid : 12;
            u32 outband_vlan_cfg_en : 1;
            u32 rsvd0 : 5;
#endif
        } bs;

        u32 value;
    } dw9;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsvd : 4;
            u32 swpt_virtio_hdr : 4;
            u32 vni : 24;
#else
            u32 vni : 24;
            u32 swpt_virtio_hdr : 4;
            u32 rsvd : 4;
#endif
        } ovs_bs;

        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsvd : 5;
            u32 vmio_core_num : 5;
            u32 base_vmio_rq_id : 8;
            u32 boot_valid : 1;
            u32 boot_func_id : 5;
            u32 boot_vmio_rq_id : 8;
#else
            u32 boot_vmio_rq_id : 8;
            u32 boot_func_id : 5;
            u32 boot_valid : 1;
            u32 base_vmio_rq_id : 8;
            u32 vmio_core_num : 5;
            u32 rsvd : 5;
#endif
        } vbs_bs;

        u32 value;
    } dw10;

    union {
        /* ovs and roce cannot coexist */
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 ovs_mac_group_id : 7;     /* ovs bum */
            u32 ovs_ethtype_group_id : 6; /* ovs bum */
            u32 vm_id : 11;
            u32 mirror_qos_vm_pps_en : 1;
            u32 mirror_qos_vm_bw_en : 1;
            u32 rsvd1 : 6;
#else
            u32 rsvd1 : 6;
            u32 mirror_qos_vm_bw_en : 1;
            u32 mirror_qos_vm_pps_en : 1;
            u32 vm_id : 11;
            u32 ovs_ethtype_group_id : 6; /* ovs bum */
            u32 ovs_mac_group_id : 7;     /* ovs bum */
#endif
        } ovs_bs;

        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 ppa_en : 1; /* 0 : ppa disable, 1: ppa enable */
            u32 ppa_miss_drop_en : 1;
            u32 rsvd0 : 1;
            u32 rsvd : 29;
#else
            u32 rsvd : 29;
            u32 rsvd0 : 1;
            u32 ppa_miss_drop_en : 1;
            u32 ppa_en : 1; /* 0 : ppa disable, 1: ppa enable */
#endif
        } ppa_bs;

        u32 value;
    } dw11;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 any_layout : 1;
            u32 mrg_rxbuf : 1;
            u32 rx_csum : 1;
            u32 f_event : 1;
            u32 f_packed : 1;
            u32 f_version1 : 1;
            u32 rsvd : 6;
            u32 mig_entry_id : 5; /* migrate address table entry index */
            u32 glb_vqn_base : 14;
            u32 host_cpu_arch : 1;
#else
            u32 host_cpu_arch : 1;
            u32 glb_vqn_base : 14;
            u32 mig_entry_id : 5; /* migrate address table entry index */
            u32 rsvd : 6;
            u32 f_version1 : 1;
            u32 f_packed : 1;
            u32 f_event : 1;
            u32 rx_csum : 1;
            u32 mrg_rxbuf : 1;
            u32 any_layout : 1;
#endif
        } virtio_bs;

        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 roce_bond_en : 1;
            u32 cpu_endian : 1; /* * 0-big endian 1-little endian */
            u32 roce_acx_en : 1;
            u32 ucapture_en : 1; /* ucode capture enable: 0-disable; 1-enable */
            u32 ip_type : 1;
            u32 bw_ctrl_en : 1;
            u32 page_size : 2;
            u32 rsvd : 4;
            u32 drcc_start_qpn : 20;
#else
            u32 drcc_start_qpn : 20;
            u32 rsvd : 4;
            u32 page_size : 2;
            u32 bw_ctrl_en : 1;
            u32 ip_type : 1;
            u32 ucapture_en : 1; /* ucode capture enable: 0-disable; 1-enable */
            u32 roce_acx_en : 1;
            u32 cpu_endian : 1; /* * 0-big endian 1-little endian */
            u32 roce_bond_en : 1;
#endif
        } roce_bs;

        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 max_lro_len : 8;
            u32 toe_lro_en : 1;
            u32 toe_bond_en : 1;
            u32 rsvd : 22;
#else
            u32 rsvd : 22;
            u32 toe_bond_en : 1;
            u32 toe_lro_en : 1;
            u32 max_lro_len : 8;
#endif
        } toe_bs;

        u32 value;
    } dw12; /* RoCE/OVS/TOE cannot coexist */

    union {
        u32 virtio_driver_feature_h;

        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsvd : 12;
            u32 max_drct : 20;
#else
            u32 max_drct : 20;
            u32 rsvd : 12;
#endif
        } roce_bs;

        u32 value;
    } dw13;

    union {
        u32 virtio_driver_feature_l;
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rb_alive_p0_fwd_id : 3;
            u32 rb_alive_p1_fwd_id : 3;
            u32 rb_alive_p2_fwd_id : 3;
            u32 rb_alive_p3_fwd_id : 3;
            u32 rb_alive_p4_fwd_id : 3;
            u32 rb_alive_p5_fwd_id : 3;
            u32 rb_alive_p6_fwd_id : 3;
            u32 rb_alive_p7_fwd_id : 3;
            u32 bond_er_fwd_id : 4;
            u32 rb_alive_slave_cnt : 4;
#else
            u32 rb_alive_slave_cnt : 4;
            u32 bond_er_fwd_id : 4;
            u32 rb_alive_p7_fwd_id : 3;
            u32 rb_alive_p6_fwd_id : 3;
            u32 rb_alive_p5_fwd_id : 3;
            u32 rb_alive_p4_fwd_id : 3;
            u32 rb_alive_p3_fwd_id : 3;
            u32 rb_alive_p2_fwd_id : 3;
            u32 rb_alive_p1_fwd_id : 3;
            u32 rb_alive_p0_fwd_id : 3;
#endif
        } roce_bs;

        u32 value;
    } dw14;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 vmsec_entry_vld : 1;    /* aka, vmsec_en */
            u32 vmsec_entry_idx : 5;
            u32 vm_rx_limit_en  : 1;
            u32 rsvd            : 16;
            u32 flow_hung : 1;
            u32 tag : 2;
            u32 fake_vld : 1;
            u32 ppf_id : 5;
#else
            u32 ppf_id : 5;
            u32 fake_vld : 1;
            u32 tag : 2;
            u32 flow_hung : 1;
            u32 rsvd : 16;
            u32 vm_rx_limit_en  : 1;
            u32 vmsec_entry_idx : 5;
            u32 vmsec_entry_vld : 1;    /* aka, vmsec_en */
#endif
        } roce_bs;
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 master_ctrl : 2;
            u32 alive_ctrl_bmp : 4;
            u32 vf_rb_bmp : 16;
            u32 act_ctrl_bmp : 4;
            u32 fake_vld : 1;
            u32 rsvd : 1;
            u32 pf_id : 4;
#else
            u32 pf_id : 4;
            u32 rsvd : 1;
            u32 fake_vld : 1;
            u32 act_ctrl_bmp : 4;
            u32 vf_rb_bmp : 16;
            u32 alive_ctrl_bmp : 4;
            u32 master_ctrl : 2;
#endif
        } nofaa;
        u32 value;
    } dw15;
} sml_funcfg_tbl_s;

typedef struct sml_lacpdu_update_frame {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsvd0 : 16;
            u32 data_len : 8;
            u32 rsvd1 : 4;
            u32 port_id : 2;
            u32 vld : 1;
            u32 busy : 1;
#else
            u32 busy : 1;
            u32 vld : 1;
            u32 port_id : 2;
            u32 rsvd1 : 4;
            u32 data_len : 8;
            u32 rsvd0 : 16;
#endif
        } bs;
        u32 value;
    } dw0;

    u32 crc_value;
    u8 data[LACP_MAX_SIZE];
    u32 rsvd[2];
} sml_lacpdu_update_frame_s;

typedef struct tag_mqp_funcfg_tbl {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 valid : 1; /* function valid: 0-invalid; 1-valid */
            u32 rsvd : 24;
            u32 drop_en : 1;
            u32 rsvd2 : 6;
#else
            u32 rsvd2 : 6;
            u32 drop_en : 1;
            u32 rsvd : 24;
            u32 valid : 1;
#endif
        } bs;

        u32 value;
    } dw0;

    u32 rsvd0;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsvd : 8;
            u32 er_id : 4;       /* edge relay id: [0~15]. support up to 16 er. */
            u32 er_fwd_type : 4; /* er forward type: 2-port; 3-fic; 4-trunk; other-unsupport  */
            u32 er_fwd_id : 16;  /* er forward id: fwd_type=2: forward ethernet port id
                                                   fwd_type=3: forward fic id(tb+tp)
                                                   fwd_type=4: forward trunk id */
#else
            u32 er_fwd_id : 16;
            u32 er_fwd_type : 4; /* er forward type: 2-port; 3-fic; 4-trunk; other-unsupport  */
            u32 er_id : 4;
            u32 rsvd : 8;
#endif
        } bs;

        u32 value;
    } dw2;

    u8 base_funcid[4];
    u32 func_num_per_host;

    u32 rsvd1;

    u32 fake_data_addr[8];

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 stub_vld : 1;
            u32 stub_sw_dly : 1;
            u32 hostid_vld : 1;
            u32 host_id : 2;
            u32 stub_sub_info : 19;
            u32 stub_code : 8;
#else
            u32 stub_code : 8;
            u32 stub_sub_info : 19;
            u32 host_id : 2;
            u32 hostid_vld : 1;
            u32 stub_sw_dly : 1;
            u32 stub_vld : 1;
#endif
        } bs;
        u32 value;
    } flr_stub;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 master_ctrl : 2;
            u32 alive_ctrl_bmp : 4;
            u32 vf_rb_bmp : 16;
            u32 act_ctrl_bmp : 4;
            u32 fake_vld : 1;
            u32 fast_recycled_mode : 1;
            u32 pf_id : 4;
#else
            u32 pf_id : 4;
            u32 fast_recycled_mode : 1;
            u32 fake_vld : 1;
            u32 act_ctrl_bmp : 4;
            u32 vf_rb_bmp : 16;
            u32 alive_ctrl_bmp : 4;
            u32 master_ctrl : 2;
#endif
        } nofaa;
        u32 value;
    } dw15;
} sml_mqp_funcfg_tbl_s;

/**
 * Struct name:    sml_portcfg_tbl_s
 * @brief          Port Configuration Table
 * Description: Port configuration attribute table
 */
typedef struct tag_sml_portcfg_tbl {
    /* valid and enable flag */
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 valid : 1;    /* valid:0-invalid; 1-valid */
            u32 learn_en : 1; /* mac learn enable: 0-disable; 1-enable */
            u32 net_upcall_limit_flag : 1;
            u32 resvd1 : 1;
            u32 qcn_en : 1;        /* qcn enable: 0-disable; 1-enable */
            u32 bond_port_vld : 1; /* if backup port,bond_port_vld=0; others, bond_port_vld=1 */
            u32 nic_car_en : 1;
            u32 ovs_bond_en : 1; /* ovs bond enable:  0-disable; 1-enable */
            u32 roce_bond_en : 1;     /* bond enable for roce */
            u32 share_plane_en : 1;
            u32 bc_to_all_function : 1;
            u32 ovs_capture_en : 1;
            u32 flow_bifur_en : 1;
            u32 nic_tx_promisc_skip : 1; /* 1:tx ignore promisc_bitmap,skip replicate to PF */
            u32 resvd : 18;
#else
            u32 resvd : 18;
            u32 nic_tx_promisc_skip : 1;
            u32 flow_bifur_en : 1;
            u32 ovs_capture_en : 1;
            u32 bc_to_all_function : 1;
            u32 share_plane_en : 1;
            u32 roce_bond_en : 1;     /* bond enable for roce */
            u32 ovs_bond_en : 1; /* ovs bond enable:  0-disable; 1-enable */
            u32 nic_car_en : 1;
            u32 bond_port_vld : 1; /* if backup port,bond_port_vld=0; others, bond_port_vld=1 */
            u32 qcn_en : 1;        /* qcn enable: 0-disable; 1-enable */
            u32 resvd1 : 1;
            u32 net_upcall_limit_flag : 1;
            u32 learn_en : 1; /* mac learn enable: 0-disable; 1-enable */
            u32 valid : 1;    /* valid:0-invalid; 1-valid */

#endif
        } bs;
        u32 value;
    } dw0;

    /* common config */
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 def_pri : 3; /* default priority */
            u32 er_mode : 2; /* edge relay mode: 0-VEB; 1-VEPA(unsupport); 2-Multi-Channel(unsupport) */
            u32 er_id : 4;   /* edge relay identifier: [0~15]. support up to 16 er. */
            u32 resvd : 23;
#else
            u32 resvd : 23;
            u32 er_id : 4;   /* edge relay identifier: [0~15]. support up to 16 er. */
            u32 er_mode : 2; /* edge relay mode: 0-VEB; 1-VEPA(unsupport); 2-Multi-Channel(unsupport) */
            u32 def_pri : 3; /* default priority */

#endif
        } bs;
        u32 value;
    } dw1;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rvsd0 : 1;
            u32 ovs_etp_en : 1;
            u32 mtu : 14;
            u32 rvsd1 : 11;
            u32 ovs_upcall_q_num : 5;
#else
            u32 ovs_upcall_q_num : 5;
            u32 rvsd1 : 11;
            u32 mtu : 14;
            u32 ovs_etp_en : 1;
            u32 rvsd0 : 1;
#endif
        } bs;
        u32 value;
    } dw2;

    /* bond config */
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 toe_bond_pf_id_array : 20;
            u32 toe_bond_pf_num : 3;
            u32 toe_bond_en : 1;
            u32 bond_id : 8; /* bond identifier: [1~4] */
#else
            u32 bond_id : 8; /* bond identifier: [1~4] */
            u32 toe_bond_en : 1;
            u32 toe_bond_pf_num : 3;
            u32 toe_bond_pf_id_array : 20;
#endif
        } bs;

        u32 value;
    } dw3;

    union {
        u32 value;
    } dw4;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 migrate_src_vni : 24;
            u32 resvd : 8;
#else
            u32 resvd : 8;
            u32 migrate_src_vni : 24;

#endif
        } bs;

        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 valid_0 : 1;
            u32 valid_1 : 1;
            u32 valid_2 : 1;
            u32 valid_3 : 1;

            u32 pf_id_0 : 5;
            u32 pf_id_1 : 5;
            u32 pf_id_2 : 5;
            u32 pf_id_3 : 5;

            u32 present_0 : 1;
            u32 present_1 : 1;
            u32 present_2 : 1;
            u32 present_3 : 1;

            u32 resvd : 4;

#else
            u32 resvd : 4;

            u32 present_3 : 1;
            u32 present_2 : 1;
            u32 present_1 : 1;
            u32 present_0 : 1;

            u32 pf_id_3 : 5;
            u32 pf_id_2 : 5;
            u32 pf_id_1 : 5;
            u32 pf_id_0 : 5;

            u32 valid_3 : 1;
            u32 valid_2 : 1;
            u32 valid_1 : 1;
            u32 valid_0 : 1;
#endif
        } single_ip_bs;

        u32 value;
    } dw5;

    union {
        u32 value;
    } dw6;

    u32 pf_promiscuous_bitmap;
} sml_portcfg_tbl_s;

typedef struct tag_sml_share_plane_tbl {
    u8 share_plane_type[OVS_SP_VLAN_NUM_PER_ITEM];
} sml_share_plane_tbl_s;

/**
 * Struct name:    sml_taggedlist_tbl_s
 * @brief          Tagged List Table
 * Description: VLAN Filtering the tagged list Table of the Trunk/Hybrid Type
 */
typedef struct tag_sml_taggedlist_tbl {
    u32 bitmap[TBL_ID_TAGGEDLIST_BITMAP32_NUM];
} sml_taggedlist_tbl_s;

/**
 * Struct name:    sml_untaggedlist_tbl_s
 * @brief          Untagged List Table
 * Description: VLAN Filtering the Untagged list Table of the Hybrid Type
 */
typedef struct tag_sml_untaggedlist_tbl {
    u32 bitmap[TBL_ID_UNTAGGEDLIST_BITMAP32_NUM];
} sml_untaggedlist_tbl_s;

/**
 * Struct name:    sml_trunkfwd_tbl_s
 * @brief          Trunk Forward Table
 * Description: port aggregation Eth-Trunk forwarding table
 */
typedef struct tag_sml_trunkfwd_tbl {
    u16 fwd_id[TBL_ID_TRUNKFWD_ENTRY_ELEM_NUM]; /* dw0-dw15 */
} sml_trunkfwd_tbl_s;

/**
 * Struct name:    sml_mac_tbl_head_u
 * @brief          Mac table request/response head
 * Hash API header in the Description: MAC table
 */
typedef union tag_sml_mac_tbl_head {
    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u32 src : 5;
        u32 instance_id : 6;
        u32 opid : 5;
        u32 A : 1;
        u32 S : 1;
        u32 rsvd : 14;
#elif (BYTE_ORDER == LITTLE_ENDIAN)
        u32 rsvd : 14;
        u32 S : 1;
        u32 A : 1;
        u32 opid : 5;
        u32 instance_id : 6;
        u32 src : 5;
#endif
    } req_bs;

    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u32 code : 2;
        u32 subcode : 2;
        u32 rsvd : 13;
        u32 node_index : 15;
#elif (BYTE_ORDER == LITTLE_ENDIAN)
        u32 node_index : 15;
        u32 rsvd : 13;
        u32 subcode : 2;
        u32 code : 2;
#endif
    } rsp_bs;

    u32 value;
} sml_mac_tbl_head_u;

/**
 * Struct name:    sml_mac_tbl_8_4_key_u
 * @brief          Mac Table Key
 * Key of the Description: MAC table.
 */
typedef union tag_sml_mac_tbl_8_4_key {
    struct {
        u32 val0;
        u32 val1;
    } value;

    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u32 er_id : 4;
        u32 vlan_id : 12;
        u32 mac_h16 : 16;

        u32 mac_m16 : 16;
        u32 mac_l16 : 16;
#elif (BYTE_ORDER == LITTLE_ENDIAN)
        u32 mac_h16 : 16;
        u32 vlan_id : 12;
        u32 er_id : 4;

        u32 mac_l16 : 16;
        u32 mac_m16 : 16;
#endif
    } bs;

    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u32 er_id : 4;
        u32 vlan_id : 12;
        u32 mac0 : 8;
        u32 mac1 : 8;

        u32 mac2 : 8;
        u32 mac3 : 8;
        u32 mac4 : 8;
        u32 mac5 : 8;
#elif (BYTE_ORDER == LITTLE_ENDIAN)
        u32 mac1 : 8;
        u32 mac0 : 8;
        u32 vlan_id : 12;
        u32 er_id : 4;

        u32 mac5 : 8;
        u32 mac4 : 8;
        u32 mac3 : 8;
        u32 mac2 : 8;
#endif
    } mac_bs;

    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u32 er_id : 4;
        u32 func_id : 12;
        u32 local_qid : 16;
        u32 rsvd;
#elif (BYTE_ORDER == LITTLE_ENDIAN)
        u32 local_qid : 16;
        u32 func_id : 12;
        u32 er_id : 4;
        u32 rsvd;
#endif
    } flex_bs;
} sml_mac_tbl_8_4_key_u;

/**
 * Struct name:    sml_mac_tbl_8_4_item_u
 * @brief          Mac Table Item
 * Description:    xxxxxxxxxxxxxxx
 */
typedef union tag_sml_mac_tbl_8_4_item {
    u32 value;

    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u32 rsvd : 7;
        u32 single_ip_en : 1;
        u32 single_ip_srv_mode : 1;
        u32 host_id : 3;
        u32 fwd_type : 4;
        u32 fwd_id : 16;
#elif (BYTE_ORDER == LITTLE_ENDIAN)
        u32 fwd_id : 16;
        u32 fwd_type : 4;
        u32 host_id : 3;
        u32 single_ip_srv_mode : 1;
        u32 single_ip_en : 1;
        u32 rsvd : 7;
#endif
    } bs;
} sml_mac_tbl_8_4_item_u;

/**
 * Struct name:    sml_mac_tbl_key_item_s
 * @brief          Mac Table( 8 + 4 )
 * Description: MAC table Key + Item
 */
typedef struct tag_sml_mac_tbl_8_4 {
    sml_mac_tbl_head_u head;
    sml_mac_tbl_8_4_key_u key;
    sml_mac_tbl_8_4_item_u item;
} sml_mac_tbl_8_4_s;

typedef union tag_sml_fdir_io_tbl_8_4_key {
    struct {
        u32 val0;
        u32 val1;
    }value;

    struct {
        u32 sip;
        u32 dip;
    }ip_bs;
} sml_fdir_io_tbl_8_4_key_u;

typedef union tag_sml_fdir_io_tbl_8_4_item {
    u32 value;

    struct {
    #if (BYTE_ORDER == BIG_ENDIAN)
        u32 rsvd : 15;
        u32 func_id : 9;
        u32 fwd_qid : 8;
    #elif (BYTE_ORDER == LITTLE_ENDIAN)
        u32 fwd_qid : 8;
        u32 func_id : 9;
        u32 rsvd : 15;
    #endif
    } bs;
} sml_fdir_io_tbl_8_4_item_u;

/**
 * Struct name:    sml_vtep_tbl_8_4_key_s
 * @brief          Vtep Table Key
 * Description:    xxxxxxxxxxxxxxx
 */
typedef struct tag_sml_vtep_tbl_8_4_key {
    u32 vtep_remote_ip;
    u32 rsvd;
} sml_vtep_tbl_8_4_key_s;

/**
 * Struct name:    dmac_smac_u
 * @brief          Dmac & Smac for VxLAN encapsulation
 * Description:    xxxxxxxxxxxxxxx
 */
typedef union tag_dmac_smac {
    u16 mac_addr[6];
    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u16 d_mac0 : 8;
        u16 d_mac1 : 8;
        u16 d_mac2 : 8;
        u16 d_mac3 : 8;

        u16 d_mac4 : 8;
        u16 d_mac5 : 8;
        u16 s_mac0 : 8;
        u16 s_mac1 : 8;

        u16 s_mac2 : 8;
        u16 s_mac3 : 8;
        u16 s_mac4 : 8;
        u16 s_mac5 : 8;
#elif (BYTE_ORDER == LITTLE_ENDIAN)
        u16 d_mac1 : 8;
        u16 d_mac0 : 8;
        u16 d_mac3 : 8;
        u16 d_mac2 : 8;

        u16 d_mac5 : 8;
        u16 d_mac4 : 8;
        u16 s_mac1 : 8;
        u16 s_mac0 : 8;

        u16 s_mac3 : 8;
        u16 s_mac2 : 8;
        u16 s_mac5 : 8;
        u16 s_mac4 : 8;
#endif
    } bs;
} dmac_smac_u;

/**
 * Struct name:    sml_vtep_tbl_8_4_item_u
 * @brief          Vtep Table Item
 * Description:    xxxxxxxxxxxxxxx
 */
typedef struct tag_sml_vtep_tbl_8_4_item {
    u32 value;
} sml_vtep_tbl_8_4_item_s;

/**
 * Struct name:    sml_vtep_tbl_8_4_s
 * @brief          Vtep Table( 8 + 20)
 * Description:    xxxxxxxxxxxxxxx
 */
typedef struct tag_sml_vtep_tbl_8_4 {
    sml_mac_tbl_head_u head; /* first 4 bytes , the same as mac tbl */
    sml_vtep_tbl_8_4_key_s key;
    sml_vtep_tbl_8_4_item_s item;
} sml_vtep_tbl_8_4_s;

/**
 * Struct name:    tag_sml_vxlan_udp_portcfg_4_8_key
 * @brief          Vtep Table Key
 * Description:    xxxxxxxxxxxxxxx
 */
typedef struct tag_sml_vxlan_udp_portcfg_4_8_key {
    u32 udp_dest_port;
    u32 rsvd;
} sml_vxlan_udp_portcfg_4_8_key_s;

/**
 * Struct name:    sml_vtep_tbl_8_20_item_u
 * @brief          Vtep Table Item
 * Description:    xxxxxxxxxxxxxxx
 */
typedef struct tag_sml_vxlan_udp_portcfg_4_8_item {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 odp_port : 12;
            u32 dp_id : 2;
            u32 resvd : 20;
#else
            u32 resvd : 20;
            u32 dp_id : 2;
            u32 odp_port : 12;
#endif
        } bs;

        u32 value;
    } dw0;
} sml_vxlan_udp_portcfg_4_8_item_s;

/**
 * Struct name:    sml_vxlan_udp_portcfg_4_8_s
 * @brief          Vxlan Dest Udp Port Table( 8 + 20)
 * Description:    xxxxxxxxxxxxxxx
 */
typedef struct tag_sml_vxlan_udp_portcfg_4_8 {
    sml_mac_tbl_head_u head; /* first 4 bytes , the same as mac tbl */
    sml_vxlan_udp_portcfg_4_8_key_s key;
    sml_vxlan_udp_portcfg_4_8_item_s item;
} sml_vxlan_udp_portcfg_4_8_s;

/**
 * Struct name:    sml_vtep_er_info_s
 * @brief          Vtep Er Info Table
 * Description:    xxxxxxxxxxxxxxx
 */
typedef struct tag_sml_vtep_er_info {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 lli_mode : 1;
            u32 er_fwd_trunk_type : 1; /* When the outbound interface of ER is bound to an Eth-Trunk, the type of the
                                          interface is (FIC/Port). */
            u32 er_fwd_trunk_mode : 4; /* When ER is bound to an Eth-Trunk interface, the interface aggregation mode is
                                          (Standby/LoadBalance/LACP). */
            u32 er_mode : 2;           /* ER mode (VEB/VEPA) */
            u32 er_id : 4; /* As the index of the LT, er_id is also used as the entry content to facilitate service
                              use. */
            u32 er_fwd_type : 4; /* Type of the egress port bound to ER (Port/FIC/Eth-Trunk) */
            u32 er_fwd_id : 16;  /* Indicates the ID(PortID/FICID/TrunkID) of the egress port bound to ER. */
#else
            u32 er_fwd_id : 16;
            u32 er_fwd_type : 4;
            u32 er_id : 4;
            u32 er_mode : 2;
            u32 er_fwd_trunk_mode : 4;
            u32 er_fwd_trunk_type : 1;
            u32 lli_mode : 1;
#endif
        } bs;

        u32 value;
    } dw0;
} sml_vtep_er_info_s;

/**
 * Struct name:    sml_logic_port_cfg_tbl_s
 * @brief          Logic Port Cfg Table
 * Description:    xxxxxxxxxxxxxxx
 */
typedef struct tag_sm_logic_port_cfg {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 odp_port : 12; /* * Input switch port (or DP_MAX_PORTS). */
            u32 dp_id : 2;     /* datapath id */
            u32 er_id : 4;
            u32 learn_en : 1; /* logic port MAC Learning enable or disable */
            u32 resvd : 13;
#else
            u32 resvd : 13;
            u32 learn_en : 1; /* logic port MAC Learning enable or disable */
            u32 er_id : 4;
            u32 dp_id : 2;     /* datapath id */
            u32 odp_port : 12; /* * Input switch port (or DP_MAX_PORTS). */
#endif
        } bs;

        u32 value;
    } dw0;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsvd4 : 1;
            u32 er_fwd_trunk_type : 1;
            u32 er_fwd_trunk_mode : 4;
            u32 er_mode : 2;
            u32 er_id : 4;
            u32 er_fwd_type : 4;
            u32 er_fwd_id : 16;
#else
            u32 er_fwd_id : 16;
            u32 er_fwd_type : 4;
            u32 er_id : 4;
            u32 er_mode : 2;
            u32 er_fwd_trunk_mode : 4;
            u32 er_fwd_trunk_type : 1;
            u32 rsvd4 : 1;
#endif
        } bs;

        u32 value;
    } dw1;
} sml_logic_port_cfg_tbl_s;

/* vport stats counter */
typedef struct tag_vport_stats_ctr {
    u16 rx_packets; /* total packets received       */
    u16 tx_packets; /* total packets transmitted    */
    u16 rx_bytes;   /* total bytes received         */
    u16 tx_bytes;   /* total bytes transmitted      */
    u16 rx_errors;  /* bad packets received         */
    u16 tx_errors;  /* packet transmit problems     */
    u16 rx_dropped; /* no space in linux buffers    */
    u16 tx_dropped; /* no space available in linux  */
} vport_stats_ctr_s;

/**
 * Struct name:    vport_s
 * @brief          Datapath Cfg Table
 * Description:    xxxxxxxxxxxxxxx
 */
typedef struct tag_vport {
#if (BYTE_ORDER == BIG_ENDIAN)
    /* dw0 */
    u32 valid : 1;
    u32 learn_en : 1;
    u32 type : 4;
    u32 dp_id : 2;
    u32 mapping_type : 4;  /* The type of Vport mapping port, 0:VF, 1:Logic Port */
    u32 mapping_port : 12; /* odp_port mapping on VF or ER Logic Port */
    u32 rsvd : 8;

    /* dw1 */
    u32 srctagl : 12; /* the function used by parent context */
    u32 xid : 20;     /* parent context XID used to upcall missed packet to ovs-vswitchd */

    /* dw2 */
    u32 odp_port : 12; /* on datapath port id */
    u32 cid : 20;      /* parent context CID used to upcall missed packet to ovs-vswitchd */
#else
    /* dw0 */
    u32 rsvd : 8;
    u32 mapping_port : 12; /* odp_port mapping on VF or ER Logic Port */
    u32 mapping_type : 4;  /* The type of Vport mapping port, 0:VF, 1:Logic Port */
    u32 dp_id : 2;
    u32 type : 4;
    u32 learn_en : 1;
    u32 valid : 1;

    /* dw1 */
    u32 xid : 20;     /* parent context XID used to upcall missed packet to ovs-vswitchd */
    u32 srctagl : 12; /* the function used by parent context */

    /* dw2 */
    u32 cid : 20;      /* parent context CID used to upcall missed packet to ovs-vswitchd */
    u32 odp_port : 12; /* on datapath port id */
#endif

    /* Dw3: Er information. This parameter is valid only for mapping_type=1(logic port). */
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 lli_mode : 1;
            u32 er_fwd_trunk_type : 1; /* When the outbound interface of ER is bound to an Eth-Trunk interface, the
                                          interface type is (FIC/Port). */
            u32 er_fwd_trunk_mode : 4; /* When ER is bound to an Eth-Trunk interface, the interface aggregation mode is
                                          (Standby/LoadBalance/LACP). */
            u32 er_mode : 2;           /* ER mode (VEB/VEPA) */
            u32 er_id : 4;             /* ERID */
            u32 er_fwd_type : 4;       /* Type of the egress port bound to ER (Port/FIC/Eth-Trunk) */
            u32 er_fwd_id : 16;        /* ID(PortID/FICID/TrunkID) of the egress port bound to ER */
#else
            u32 er_fwd_id : 16;
            u32 er_fwd_type : 4;
            u32 er_id : 4;
            u32 er_mode : 2;
            u32 er_fwd_trunk_mode : 4;
            u32 er_fwd_trunk_type : 1; /* When the outbound interface of ER is Eth-Trunk, the type of the interface is
                                          (FIC/Port). */
            u32 lli_mode : 1;
#endif
        } bs;
        u32 value;
    } dw3;

    /* dw4~dw7 */
    vport_stats_ctr_s stats; /* vport stats counters */
} vport_s;

/**
 * Struct name:    sml_elb_tbl_elem_u
 * @brief          ELB Table Elem
 * Description: ELB Leaf Subtable Member
 */
typedef union tag_sml_elb_tbl_elem {
    struct {
        u32 fwd_val;
        u32 next_val;
    } value;

    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u32 rsvd0 : 10;
        u32 qinq_cfg : 2;
        u32 fwd_type : 4;
        u32 fwd_id : 16;

        u32 rsvd1 : 17;
        u32 elb_index_next : 15;
#elif (BYTE_ORDER == LITTLE_ENDIAN)
        u32 fwd_id : 16;
        u32 fwd_type : 4;
        u32 qinq_cfg : 2;
        u32 rsvd0 : 10;

        u32 elb_index_next : 15;
        u32 rsvd1 : 17;
#endif
    } bs;
} sml_elb_tbl_elem_u;

/**
 * Struct name:    sml_elb_tbl_s
 * @brief          ELB Table
 * Entry of the Description: ELB leaf table
 */
typedef struct tag_sml_elb_tbl {
    sml_elb_tbl_elem_u elem[TBL_ID_ELB_ENTRY_ELEM_NUM];
} sml_elb_tbl_s;

/**
 * Struct name:    sml_vlan_tbl_elem_u
 * @brief          VLAN Table Elem
 * Description: VLAN BC table member
 */
typedef union tag_sml_vlan_tbl_elem {
    u16 value;

    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u16 learn_en : 1;
        u16 elb_index : 15;
#elif (BYTE_ORDER == LITTLE_ENDIAN)
        u16 elb_index : 15;
        u16 learn_en : 1;
#endif
    } bs;
} sml_vlan_tbl_elem_u;

/**
 * Struct name:    sml_vlan_tbl_s
 * @brief          VLAN Table
 * Description: VLAN BC Table Entry
 */
typedef struct tag_sml_vlan_tbl {
    sml_vlan_tbl_elem_u elem[TBL_ID_VLAN_ENTRY_ELEM_NUM];
} sml_vlan_tbl_s;

/**
 * Struct name:    sml_multicast_tbl_array_u
 * @brief          Multicast Table Elem
 * Description: multicast table member
 */
typedef union tag_sml_multicast_tbl_elem {
    struct {
        u32 next_val;
    } value;

    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u32 rsvd1 : 17;
        u32 elb_index : 15;
#elif (BYTE_ORDER == LITTLE_ENDIAN)
        u32 elb_index : 15;
        u32 rsvd1 : 17;
#endif
    } bs;
} sml_multicast_tbl_elem_u;

/**
 * Struct name:    sml_multicast_tbl_s
 * @brief          Multicast Table
 * Description: Entry of the multicast table
 */
typedef struct tag_sml_multicast_tbl {
    sml_multicast_tbl_elem_u elem[TBL_ID_MULTICAST_ENTRY_ELEM_NUM];
} sml_multicast_tbl_s;

/**
 * Struct name:    sml_observe_port_s
 * @brief          Observe Port Table
 * Description: Observe the definition of the port entry.
 */
typedef struct tag_sml_observe_port {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 valid : 1;
            u32 rsvd0 : 11;
            u32 dst_type : 4;
            u32 dst_id : 16;
#else
            u32 dst_id : 16;
            u32 dst_type : 4;
            u32 rsvd0 : 11;
            u32 valid : 1;
#endif
        } bs;
        u32 value;
    } dw0;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsvd1 : 4;
            u32 vlan_id : 12;
            u32 rsvd2 : 2;
            u32 cut_len : 14;
#else
            u32 cut_len : 14;
            u32 rsvd2 : 2;
            u32 vlan_id : 12;
            u32 rsvd1 : 4;
#endif
        } bs;
        u32 value;
    } dw1;

    u32 rsvd_pad[2];
} sml_observe_port_s;

/*
 * Struct name:    sml_ipmac_tbl_16_12_key_s
 * @brief          ipmac filter table key
 * Description:    ipmac filter key define
 */
typedef struct tag_sml_ipmac_tbl_16_12_key {
#if (BYTE_ORDER == BIG_ENDIAN)
    u32 func_id : 16;
    u32 mac_h16 : 16;
#else
    u32 mac_h16 : 16;
    u32 func_id : 16;
#endif

#if (BYTE_ORDER == BIG_ENDIAN)
    u32 mac_m16 : 16;
    u32 mac_l16 : 16;
#else
    u32 mac_l16 : 16;
    u32 mac_m16 : 16;
#endif

    u32 ip;
    u32 rsvd;
} sml_ipmac_tbl_16_12_key_s;

/*
 * Struct name:    sml_ipmac_tbl_16_12_item_s
 * @brief          ipmac filter table item
 * Description:    ipmac filter item define
 */
typedef struct tag_sml_ipmac_tbl_16_12_item {
    u32 rsvd[3];
} sml_ipmac_tbl_16_12_item_s;

/*
 * Struct name:    sml_ethtype_tbl_8_4_key_s
 * @brief          ethtype filter table key
 * Description:    ethtype filter key define
 */
typedef struct tag_sml_ethtype_tbl_8_4_key {
#if (BYTE_ORDER == BIG_ENDIAN)
    u32 group_id : 16;
    u32 ethtype : 16;
#else
    u32 ethtype : 16;
    u32 group_id : 16;
#endif

    u32 rsvd;
} sml_ethtype_tbl_8_4_key_s;

/*
 * Struct name:    sml_ethtype_tbl_8_4_item_s
 * @brief          ethtype filter table item
 * Description:    ethtype filter item define
 */
typedef struct tag_sml_ethtype_tbl_8_4_item {
    u32 rsvd;
} sml_ethtype_tbl_8_4_item_s;


/* Indicates the direction of packets recorded by the ACL in the dfx. */
typedef enum {
    ACL_PKT_TX = 0,
    ACL_PKT_RX = 1
} sml_acl_pkt_dir_e;

/* ACL policy table item */
typedef struct tag_sml_acl_policy_tbl {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 drop : 1;
            u32 car_en : 1;
            u32 car_id : 12;
            u32 counter_type : 2;
            u32 counter_id : 16;
#else
            u32 counter_id : 16;
            u32 counter_type : 2;
            u32 car_id : 12;
            u32 car_en : 1;
            u32 drop : 1;
#endif
        } bs;

        u32 value;
    } dw0;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsvd1 : 7;
            u32 mirrior_en : 1;
            u32 observer_port : 10;
            u32 change_dscp : 1;
            u32 new_dscp : 6;
            u32 change_pkt_pri : 1;
            u32 new_pkt_pri : 3;
            u32 redirect_en : 3;
#else
            u32 redirect_en : 3;
            u32 new_pkt_pri : 3;
            u32 change_pkt_pri : 1;
            u32 new_dscp : 6;
            u32 change_dscp : 1;
            u32 observer_port : 10;
            u32 mirrior_en : 1;
            u32 rsvd1 : 7;
#endif
        } bs;

        u32 value;
    } dw1;

    u32 redirect_data;
    u32 rsvd2;
} sml_acl_policy_tbl_s;

typedef struct tag_sml_acl_ipv4_key {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 padding : 16; /* Used for alignment. The match_key_type and later fields are used to search for the key
                                 value. */
            u32 tid0 : 2;
            u32 match_key_type : 3; /* Matching type. */
            u32 rsvd : 11;          /* Reserved field */
#else
            u32 rsvd : 11;
            u32 match_key_type : 3;
            u32 tid0 : 2;
            u32 padding : 16;
#endif
        } bs;
        u32 value;
    } dw0;

    /* dw1&dw2 */
    u32 sipv4;
    u32 dipv4;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 l4_sport : 16;
            u32 l4_dport : 16;
#else
            u32 l4_dport : 16;
            u32 l4_sport : 16;
#endif
        } bs;
        u32 value;
    } dw3;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 l4_protocol : 8;
            u32 rsvd0 : 8;
            u32 seg_id : 10;
            u32 rsvd1 : 6;
#else
            u32 rsvd1 : 6;
            u32 seg_id : 10;
            u32 rsvd0 : 8;
            u32 l4_protocol : 8;
#endif
        } bs;
        u32 value;
    } dw4;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 tid1 : 2;
            u32 rsvd : 14;
            u32 padding : 16;
#else
            u32 padding : 16;
            u32 rsvd : 14;
            u32 tid1 : 2;
#endif
        } bs;
        u32 value;
    } dw5;
} sml_acl_ipv4_key_s;

typedef struct tag_sml_acl_ipv6_key {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 padding : 16; /* Used for alignment. The match_key_type and later fields are used to search for the key
                                 value. */
            u32 tid0 : 2;
            u32 match_key_type : 3; /* Matching type. */
            u32 rsvd : 11;          /* Reserved field */
#else
            u32 rsvd : 11;
            u32 match_key_type : 3;
            u32 tid0 : 2;
            u32 padding : 16;
#endif
        } bs;
        u32 value;
    } dw0;

    /* dw1~dw4 */
    u32 sipv6[4];

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 tid1 : 2;
            u32 rsvd1 : 14;
            u32 tid2 : 2;
            u32 rsvd2 : 14;
#else
            u32 rsvd2 : 14;
            u32 tid2 : 2;
            u32 rsvd1 : 14;
            u32 tid1 : 2;
#endif
        } bs;
        u32 value;
    } dw5;

    /* dw6~dw9 */
    u32 dipv6[4];

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 tid3 : 2;
            u32 rsvd3 : 14;
            u32 tid4 : 2;
            u32 rsvd4 : 14;
#else
            u32 rsvd4 : 14;
            u32 tid4 : 2;
            u32 rsvd3 : 14;
            u32 tid3 : 2;
#endif
        } bs;
        u32 value;
    } dw10;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 l4_sport : 16;
            u32 l4_dport : 16;
#else
            u32 l4_dport : 16;
            u32 l4_sport : 16;
#endif
        } bs;
        u32 value;
    } dw11;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 l4_protocol : 8;
            u32 rsvd0 : 8;
            u32 seg_id : 10;
            u32 rsvd1 : 6;
#else
            u32 rsvd1 : 6;
            u32 seg_id : 10;
            u32 rsvd0 : 8;
            u32 l4_protocol : 8;
#endif
        } bs;
        u32 value;
    } dw12;

    u32 dw13;
    u32 dw14;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 tid5 : 2;
            u32 rsvd5 : 14;
            u32 tid6 : 2;
            u32 rsvd6 : 14;
#else
            u32 rsvd6 : 14;
            u32 tid6 : 2;
            u32 rsvd5 : 14;
            u32 tid5 : 2;
#endif
        } bs;
        u32 value;
    } dw15;

    u32 dw16;
    u32 dw17;
    u32 dw18;
    u32 dw19;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 tid7 : 2;
            u32 rsvd7 : 30;
#else
            u32 rsvd7 : 30;
            u32 tid7 : 2;
#endif
        } bs;
        u32 value;
    } dw20;
} sml_acl_ipv6_key_s;

/**
 * Struct name:    sml_fdir_cfg_tbl_s
 * @brief          Function FDIR cfg Table
 * Description:    Function FDIR control cfg
 */
typedef struct sml_fdir_cfg_tbl {
    u16 packet_fdir_cfg[FDIR_CFG_TABLE_PACKET_TYPE_NUM]; /* 16 packet_type */
} sml_fdir_cfg_tbl_s;

/**
 * Struct name:    sml_voq_map_table_s
 * @brief          voq_map_table
 * Description:    xxxxxxxxxxxxxxx
 */
typedef struct tag_sml_voq_map_table {
    u16 voq_base[8];
} sml_voq_map_table_s;

/**
 * Struct name:    sml_rss_context_u
 * @brief          rss_context
 * Description:    xxxxxxxxxxxxxxx
 */
typedef union tag_sml_rss_context {
    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u32 udp_ipv4 : 1;
        u32 udp_ipv6 : 1;
        u32 ipv4 : 1;
        u32 tcp_ipv4 : 1;
        u32 ipv6 : 1;
        u32 tcp_ipv6 : 1;
        u32 ipv6_ext : 1;
        u32 tcp_ipv6_ext : 1;
        u32 valid : 1;
        u32 rsvd1 : 13;
        u32 def_qpn : 10;
#else
        u32 def_qpn : 10;
        u32 rsvd1 : 13;
        u32 valid : 1;
        u32 tcp_ipv6_ext : 1;
        u32 ipv6_ext : 1;
        u32 tcp_ipv6 : 1;
        u32 ipv6 : 1;
        u32 tcp_ipv4 : 1;
        u32 ipv4 : 1;
        u32 udp_ipv6 : 1;
        u32 udp_ipv4 : 1;
#endif
    } bs;

    u32 value;
} sml_rss_context_u;

typedef struct tag_sml_rss_context_tbl {
    sml_rss_context_u element[TBL_ID_RSS_CONTEXT_NUM];
} sml_rss_context_tbl_s;

/**
 * Struct name:    sml_rss_hash_u
 * @brief          rss_hash
 * Description:    xxxxxxxxxxxxxxx
 */
typedef union tag_sml_rss_hash {
    u8 rq_index[256];
} sml_rss_hash_u;

typedef struct tag_sml_rss_hash_tbl {
    sml_rss_hash_u element[TBL_ID_RSS_HASH_NUM];
} sml_rss_hash_tbl_s;

/**
 * Struct name:    sml_lli_5tuple_key_s
 * @brief          lli_5tuple_key
 * Description:    xxxxxxxxxxxxxxx
 */
typedef struct tag_sml_lli_5tuple_key {
    union {
        struct {
/* * Define the struct bits */
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 src : 5; /* * Here, tile is set to Dest. */
            u32 rt : 1;
            u32 key_size : 2;   /* * determines which action that engine will take */
            u32 profile_id : 3; /* * indicates that requestor expect to receive a response data */
            u32 op_id : 5;
            u32 a : 1;
            u32 rsvd : 12;
            u32 vld : 1;
            u32 xy : 1;
            u32 at : 1;
#else
            u32 at : 1;
            u32 xy : 1;
            u32 vld : 1;   /* * indicates that requestor expect to receive a response data */
            u32 rsvd : 12; /* * determines which action that engine will take */
            u32 a : 1;
            u32 op_id : 5;
            u32 profile_id : 3;
            u32 key_size : 2;
            u32 rt : 1;
            u32 src : 5;
#endif
        } bs;

        /* * Define an unsigned member */
        u32 value;
    } dw0;
    union {
        struct {
            u32 rsvd : 1; /* * Set tile to Dest. */
            u32 address : 15;

            u32 table_type : 5;
            u32 ip_type : 1;
            u32 func_id : 10;
        } bs;

        u32 value;
    } misc;

    u32 src_ip[4];
    u32 dst_ip[4];

    u16 src_port;
    u16 dst_port;

    u8 protocol;
    u8 tcp_flag;
    u8 fcoe_rctl;
    u8 fcoe_type;
    u16 eth_type;

    // If the u16 frame_size; /* range is matched, the */ is not performed temporarily.
} sml_lli_5tuple_key_s;

/**
 * Struct name:    sml_lli_5tuple_rsp_s
 * @brief          lli_5tuple_rsp
 * Description:    xxxxxxxxxxxxxxx
 */
typedef struct tag_sml_lli_5tuple_rsp {
    union {
        struct {
            u32 state : 4;
            u32 rsvd : 28;
        } bs;

        u32 value;
    } dw0;

    u32 dw1;

    union {
        struct {
            u32 frame_size : 16;
            u32 lli_en : 8;
            u32 rsvd : 8;
        } bs;

        u32 value;
    } dw2;

    u32 dw3;
} sml_lli_5tuple_rsp_s;

typedef union tag_sml_global_queue_tbl_elem {
    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u32 src_tag_l : 16;
        u32 local_qid : 8;
        u32 rsvd : 8;
#elif (BYTE_ORDER == LITTLE_ENDIAN)
        u32 rsvd : 8;
        u32 local_qid : 8;
        u32 src_tag_l : 16;
#endif
    } bs;

    u32 value;
} sml_global_queue_tbl_elem_u;


typedef struct tag_sml_global_queue_tbl {
    sml_global_queue_tbl_elem_u element[TBL_ID_GLOBAL_QUEUE_NUM];
} sml_global_queue_tbl_s;

typedef struct tag_sml_dfx_log_tbl {
    u32 wr_init_pc_h32; /* Initial value of write_pc */
    u32 wr_init_pc_l32;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 state : 8;
            u32 func_en : 1;
            u32 srctag : 12;
            u32 max_num : 11; /* Maximum data block size */
#else
            u32 max_num : 11; /* Maximum data block size */
            u32 srctag : 12;
            u32 func_en : 1;
            u32 state : 8;
#endif
        } bs;
        u32 value;
    } dw2;

    u32 ci_index;
} sml_dfx_log_tbl_s;


typedef struct tag_sml_glb_capture_tbl {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 valid : 1;
            u32 max_num : 15;
            u32 rsvd : 16;
#else
            u32 rsvd : 16;
            u32 max_num : 15;
            u32 valid : 1;
#endif
        } bs;
        u32 value;
    } dw0;

    u32 discard_addr_h32;
    u32 discard_addr_l32;

    u32 rsvd0;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 valid : 1;
            u32 mode : 5;
            u32 direct : 2;
            u32 offset : 8;
            u32 cos : 3;
            u32 max_num : 13;
#else
            u32 max_num : 13;
            u32 cos : 3;
            u32 offset : 8;
            u32 direct : 2;
            u32 mode : 5;
            u32 valid : 1;
#endif
        } bs;
        u32 value;
    } dw4;

    u32 data_vlan;

    u32 condition_addr_h32;
    u32 condition_addr_l32;
} sml_glb_capture_tbl_s;

typedef struct tag_sml_cqe_addr_tbl {
    u32 cqe_first_addr_h32;
    u32 cqe_first_addr_l32;
    u32 cqe_last_addr_h32;
    u32 cqe_last_addr_l32;
} sml_cqe_addr_tbl_s;

/**
 * Struct name:    sml_ucode_exec_info_tbl_s
 * @brief          ucode execption info Table
 * Description: microcode exception information table
 */
typedef struct tag_ucode_exec_info_tbl {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 wptr_cpb_ack_str : 4;      /* Dispatch-streamout Write pointer position */
            u32 mem_cpb_ack_cnums_dma : 4; /* Number of pre-deducted cells that are actually consumed. */
            u32 mem_cpb_ack_cmd_mode : 2;  /* ?? */
            u32 pr_ret_vld : 1;            /* Pr_mc, 1: microcode pre-deduction, 0:OQ pre-deduction */
            u32 oeid_pd_pkt : 1;           /* Check whether there are original packets in the abnormal message. */
            u32 rptr_cmd : 4;              /* OEID socket read pointer */
            u32 wptr_cmd : 4;              /* OEID socket write pointer */
            u32 src_tag_l : 12;            /* HostID+Func_id, uP Where can I obtain??? */
#else
            u32 src_tag_l : 12;
            u32 wptr_cmd : 4;
            u32 rptr_cmd : 4;
            u32 oeid_pd_pkt : 1;
            u32 pr_ret_vld : 1;
            u32 mem_cpb_ack_cmd_mode : 2;
            u32 mem_cpb_ack_cnums_dma : 4;
            u32 wptr_cpb_ack_str : 4;
#endif
        } bs;

        u32 value;
    } dw0;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 fq : 16; /* Indicates the ID of the FQ where the OEID whose watch-dog times out is located. */
            u32 exception_type : 4;   /* Exception type. If the value is 1, it indicates that the OEID is reclaimed. */
            u32 rptr_cpb_ack_str : 4; /* Dispatch-streamout Position of the read pointer */
            u32 header_oeid : 8;      /* Indicates whether the header is a header OEID. */
#else
            u32 header_oeid : 8;
            u32 rptr_cpb_ack_str : 4;
            u32 exception_type : 4;
            u32 fq : 16;
#endif
        } bs;

        u32 value;
    } dw1;

    u32 oeid_pd_data_l32;
    u32 oeid_pd_data_m32;
} sml_ucode_exec_info_s;

typedef struct rq_iq_mapping_tbl {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rq_bp_en : 3;
            u32 rqid : 13;
            u32 iqid : 8;
            u32 portid : 8;
#else
            u32 portid : 8;
            u32 iqid : 8;
            u32 rqid : 13;
            u32 rq_bp_en : 3;
#endif
        } bs;
        u32 value;
    } dw[4];
} sml_rq_iq_mapping_tbl_s;

typedef struct rq_iq_bp_state_tbl {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rq_id : 16;
            u32 iq_mask : 8;
            u32 port_id : 8;
#else
            u32 port_id : 8;
            u32 iq_mask : 8;
            u32 rq_id : 16;
#endif
        } bs;
        u32 value;
    } dw[4];
} sml_rq_iq_bp_state_tbl_s;

/*
 * nic_ucode_rq_ctx table define
 */
typedef struct nic_ucode_rq_ctx {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 ci : 16;
            u32 pi : 16;

#else
            u32 pi : 16;
            u32 ci : 16;
#endif
        } bs;
        u32 value;
    } dw0;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 ceq_en : 1;
            u32 int_num : 10;
            u32 cqe_count : 10;
            u32 rsv1_1st : 11;

#else
            u32 rsv1_1st : 11;
            u32 cqe_count : 10;
            u32 int_num : 10;
            u32 ceq_en : 1;
#endif
        } bs;
        u32 value;
    } dw1;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 o_bit : 1;
            u32 psge_valid : 1;
            u32 wqe_type : 2;
            u32 rsv0_1st : 8;
            u32 ci_wqe_page_addr_h : 20;

#else
            u32 ci_wqe_page_addr_h : 20;
            u32 rsv0_1st : 8;
            u32 wqe_type : 2;
            u32 psge_valid : 1;
            u32 o_bit : 1;
#endif
        } bs;
        u32 value;
    } dw2;
    u32 ci_wqe_page_addr_l32;

    u32 rsvd[2];

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsv3_1st : 19;
            u32 rq_id_vf : 13;

#else
            u32 rq_id_vf : 13;
            u32 rsv3_1st : 19;
#endif
        } bs;
        u32 value;
    } dw6;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsv2_1st : 2;
            u32 cs_sge : 2;
            u32 max_count : 10;
            u32 cqe_template : 6;
            u32 pkt_template : 6;
            u32 wqe_template : 6;
#else
            u32 wqe_template : 6;
            u32 pkt_template : 6;
            u32 cqe_template : 6;
            u32 max_count : 10;
            u32 cs_sge : 2;
            u32 rsv2_1st : 2;
#endif
        } bs;
        u32 value;
    } dw7;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 pft_min : 7;
            u32 pft_max : 11;
            u32 pft_thd : 14;
#else
            u32 pft_thd : 14;
            u32 pft_max : 11;
            u32 pft_min : 7;
#endif
        } bs;
        u32 value;
    } dw8;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsv0_2nd : 27;
            u32 o_bit : 1;
            u32 pft_ci_h : 4;
#else
            u32 pft_ci_h : 4;
            u32 o_bit : 1;
            u32 rsv0_2nd : 27;
#endif
        } bs;
        u32 value;
    } dw9;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 pft_ci_l : 12;
            u32 pft_ci_page_addr_h : 20;
#else
            u32 pft_ci_page_addr_h : 20;
            u32 pft_ci_l : 12;
#endif
        } bs;
        u32 value;
    } dw10;

    u32 pft_ci_page_addr_l;

    u32 pi_gpa_h;
    u32 pi_gpa_l;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsv0_3rd : 9;
            u32 ci_cla_addr_h : 23;
#else
            u32 ci_cla_addr_h : 23;
            u32 rsv0_3rd : 9;
#endif
        } bs;
        u32 value;
    } dw14;

    u32 ci_cla_addr_l;
} nic_ucode_rq_ctx_s;

/*
 * nic_ucode_sq_ctx table define
 */
typedef struct nic_ucode_sq_ctx {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 ci : 16;
            u32 pi : 16;

#else
            u32 pi : 16;
            u32 ci : 16;
#endif
        } bs;
        u32 value;
    } dw0;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 tso_fail_last_time : 2;
            u32 rsv0_2nd : 19;
            u32 err_code : 2;
            u32 q_dis : 1;
            u32 rsv0_1st : 5;
            u32 tso_first_sge_vld : 1;
            u32 drop_pkt_md : 1;
            u32 sp_flag : 1;

#else
            u32 sp_flag : 1;
            u32 drop_pkt_md : 1;
            u32 tso_first_sge_vld : 1;
            u32 rsv0_1st : 5;
            u32 q_dis : 1;
            u32 err_code : 2;
            u32 rsv0_2nd : 19;
            u32 tso_fail_last_time : 2;
#endif
        } bs;
        u32 value;
    } dw1;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 sge_num_left : 8;
            u32 o_bit : 1;
            u32 tso_doing : 1;
            u32 processing_sge_id : 2;
            u32 ci_wqe_page_addr_h : 20;

#else
            u32 ci_wqe_page_addr_h : 20;
            u32 processing_sge_id : 2;
            u32 tso_doing : 1;
            u32 o_bit : 1;
            u32 sge_num_left : 8;
#endif
        } bs;
        u32 value;
    } dw2;
    u32 ci_wqe_page_addr_l32;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsv3_1st : 24;
            u32 sp_set_thd : 8;
#else
            u32 sp_set_thd : 8;
            u32 rsv3_1st : 24;
#endif
        } bs;
        u32 value;
    } dw4;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 drop_pkt_off_thd : 16;
            u32 drop_pkt_on_thd : 16;

#else
            u32 drop_pkt_on_thd : 16;
            u32 drop_pkt_off_thd : 16;
#endif
        } bs;
        u32 value;
    } dw5;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 pkt_template : 6;
            u32 wqe_template : 6;
            u32 rsv2_1st : 7;
            u32 glb_sq_id : 13;
#else
            u32 glb_sq_id : 13;
            u32 rsv2_1st : 7;
            u32 wqe_template : 6;
            u32 pkt_template : 6;
#endif
        } bs;
        u32 value;
    } dw6;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 ceq_num : 8;
            u32 ceq_en : 1;
            u32 rsv1_1st : 2;
            u32 vlan_inst_mode : 2;
            u32 vlan_sel : 3;
            u32 vlan_tag : 16;
#else
            u32 vlan_tag : 16;
            u32 vlan_sel : 3;
            u32 vlan_inst_mode : 2;
            u32 rsv1_1st : 2;
            u32 ceq_en : 1;
            u32 ceq_num : 8;
#endif
        } bs;
        u32 value;
    } dw7;
} nic_ucode_sq_ctx_s;


/* mips exception info table defination */
#define SML_MIPS_EXCP_TBL_ENTRY_NUM (256)
#define SML_MIPS_EXCP_TBL_ENTRY_SIZE (64)
typedef struct tag_sml_mips_exception_info_tbl {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 valid : 1;
            u32 exception_code : 5;
            u32 core_id : 6;
            u32 thread_id : 2;
            u32 rsvd1 : 8;
            u32 io7_status : 5;
            u32 io6_status : 5;
#else
            u32 io6_status : 5;
            u32 io7_status : 5;
            u32 rsvd1 : 8;
            u32 thread_id : 2;
            u32 core_id : 6;
            u32 exception_code : 5;
            u32 valid : 1;
#endif
        } bs;

        u32 value;
    } dw0;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsvd1 : 2;
            u32 io5_status : 5;
            u32 io4_status : 5;
            u32 io3_status : 5;
            u32 io2_status : 5;
            u32 io1_status : 5;
            u32 io0_status : 5;
#else
            u32 io0_status : 5;
            u32 io1_status : 5;
            u32 io2_status : 5;
            u32 io3_status : 5;
            u32 io4_status : 5;
            u32 io5_status : 5;
            u32 rsvd1 : 2;
#endif
        } bs;

        u32 value;
    } dw1;

    u32 epc;
    u32 status_info;
    u32 push_data[4];
    u32 metadata[8];
} sml_mips_exception_info_tbl_s;

#define RQ_CTX_SIZE 64
#define SQ_CTX_SIZE 64

/*
 * ovs multi-table define
 */
typedef union tag_sml_ovs_mutil_tbl {
    /* for qos store value table */
    struct {
        u32 func_tx_cir;
        u32 func_tx_cbs;
        u32 func_tx_pir;
        u32 func_tx_pbs;

        u32 func_rx_cir;
        u32 func_rx_cbs;
        u32 func_rx_pir;
        u32 func_rx_pbs;

        u32 func_bcmc_limit;
        u32 func_bcmc_burst;

        u32 upcall_cir_limit;
        u32 upcall_cbs_burst;
        u32 upcall_xir_limit;
        u32 upcall_xbs_burst;

        u32 rsvd[2];
    } func_qos_value;

    struct {
        u32 vm_tx_cir;
        u32 vm_tx_cbs;
        u32 vm_tx_pir;
        u32 vm_tx_pbs;

        u32 vm_rx_cir;
        u32 vm_rx_cbs;
        u32 vm_rx_pir;
        u32 vm_rx_pbs;

        u32 vm_rx_pps_limit;
        u32 vm_rx_pps_burst;

        u32 vm_pps_limit;
        u32 vm_pps_burst;

        u32 rsvd[4];
    } vm_qos_value;

    u32 value[16];
} sml_ovs_mutil_tbl_u;

/*
 * ovs vlan to localtag table define
 */
#define OVS_VLAN_LOCALTAG_ITEM_NUM (4)
typedef struct tag_sml_vlan_localtag_tbl {
    u32 localtag[OVS_VLAN_LOCALTAG_ITEM_NUM];
} sml_vlan_localtag_tbl_s;

#define OVS_VM_MAX_FUNCTION_NUM 16

typedef union function_valid_unit {
    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u16 func_num_h3bit : 3; /* when index=0, function_num_high_3bit; */
        u16 function_valid : 1;
        u16 function_id : 12;
#else
        u16 function_id : 12;
        u16 function_valid : 1;
        u16 func_num_h3bit : 3;
#endif
    } item0;

    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u16 func_num_l3bit : 3; /* when index=1, function_num_low_3bit */
        u16 function_valid : 1;
        u16 function_id : 12;
#else
        u16 function_id : 12;
        u16 function_valid : 1;
        u16 func_num_l3bit : 3;
#endif
    } item1;

    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u16 rsvd : 1;
        u16 vm_bps_cfg : 1; /* only index=2, vm_bps_cfg is valid */ /* only index=3, vm_rx_bps_cfg is valid */
        u16 vm_pps_cfg : 1; /* only index=2, vm_pps_cfg is valid */ /* only index=3, vm_rx_pps_cfg is valid */
        u16 function_valid : 1;
        u16 function_id : 12;
#else
        u16 function_id : 12;
        u16 function_valid : 1;
        u16 vm_pps_cfg : 1;
        u16 vm_bps_cfg : 1;
        u16 rsvd : 1;
#endif
    } bs;

    u16 value;
} function_valid_unit_u;

typedef struct tag_sml_vm_mapping_tbl {
    function_valid_unit_u func_vld_unit[OVS_VM_MAX_FUNCTION_NUM];
} sml_vm_mapping_tbl_s;

typedef struct tag_ovs_vtep_tun_info_tbl {
    /* dw0~dw2 */
#if (BYTE_ORDER == BIG_ENDIAN)
    u32 dmac_h : 16;
    u32 dmac_m : 16;

    u32 dmac_l : 16;
    u32 smac_h : 16;

    u32 smac_m : 16;
    u32 smac_l : 16;
#else
    u32 dmac_m : 16;
    u32 dmac_h : 16;

    u32 smac_h : 16;
    u32 dmac_l : 16;

    u32 smac_l : 16;
    u32 smac_m : 16;
#endif
    u32 sip;
    u32 dip;
#if (BYTE_ORDER == BIG_ENDIAN)
    u32 vlan_id : 16;
    u32 udp_sport : 16;

    u32 rsvd : 8;
    u32 vni : 24;
#else
    u32 udp_sport : 16;
    u32 vlan_id : 16;

    u32 vni : 24;
    u32 rsvd : 8;
#endif

#if (BYTE_ORDER == BIG_ENDIAN)
    u32 rsvd1 : 16;
    u32 output_id : 16;
#else
    u32 output_id : 16;
    u32 rsvd1 : 16;
#endif

    u8 tap_name[32];
} sml_ovs_vtep_tun_info_tbl_s;

typedef union {
    u32 mac32_s[3];

    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u32 smac_h : 16;
        u32 smac_m : 16;

        u32 smac_l : 16;
        u32 dmac_h : 16;

        u32 dmac_m : 16;
        u32 dmac_l : 16;
#else
        u32 smac_m : 16;
        u32 smac_h : 16;

        u32 dmac_h : 16;
        u32 smac_l : 16;

        u32 dmac_l : 16;
        u32 dmac_m : 16;
#endif
    } mac16_s;
} sml_ovs_cap_dmac_smac_u;

typedef union tag_ovs_pcap_precfg {
    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u32 vport_id : 16;
        u32 rsvd : 6;
        u32 direct_in : 1;
        u32 direct_out : 1;
        u32 vxlan_inner : 3;
        u32 valid : 1;
        u32 rule_idx : 3;
        u32 all_pass : 1;
#else
        u32 all_pass : 1;
        u32 rule_idx : 3;
        u32 valid : 1;
        u32 vxlan_inner : 3;
        u32 direct_out : 1;
        u32 direct_in : 1;
        u32 rsvd : 6;
        u32 vport_id : 16;
#endif
    } bs;
    u32 value;
} ovs_pcap_precfg_u;

typedef struct tag_sml_ovs_pcap_precfg_tbl {
    ovs_pcap_precfg_u pcap_precfg[8];
    u32 rsvd[8];
} sml_ovs_pcap_precfg_tbl_s;

typedef struct tag_sml_ovs_pcap_filter_ipv6 {
    u32 sipv6_0;
    u32 sipv6_1;
    u32 sipv6_2;
    u32 sipv6_3;

    u32 dipv6_0;
    u32 dipv6_1;
    u32 dipv6_2;
    u32 dipv6_3;

    u32 hipv6_0;
    u32 hipv6_1;
    u32 hipv6_2;
    u32 hipv6_3;

    u32 rsvd0;
    u32 rsvd1;
    u32 rsvd2;
    u32 rsvd3;
} sml_ovs_pcap_filter_ipv6_s;

typedef union {
    u32 mask_ipv4;

    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u32 m0 : 8; /* mask number for sipv6_0/dipv6_0/hipv6_0 */
        u32 m1 : 8; /* mask number for sipv6_1/dipv6_1/hipv6_1 */
        u32 m2 : 8; /* mask number for sipv6_2/dipv6_2/hipv6_2 */
        u32 m3 : 8; /* mask number for sipv6_3/dipv6_3/hipv6_3 */
#else
        u32 m3 : 8;
        u32 m2 : 8;
        u32 m1 : 8;
        u32 m0 : 8;
#endif
    } mask_ipv6;
} ip_mask_u;

typedef union tag_sml_ovs_pcap_mask {
    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u16 smac_en : 1;
        u16 dmac_en : 1;
        u16 vlan_en : 1;
        u16 eth_type_en : 1;
        u16 sip_en : 1;
        u16 dip_en : 1;
        u16 host_ip_en : 1;
        u16 dscp_en : 1;
        u16 proto_en : 1;
        u16 sport_en : 1;
        u16 dport_en : 1;
        u16 cnter_en : 1;
        u16 vni_en : 1;
        u16 ip_type : 1;
        u16 host_port_en : 1;
        u16 rsvd : 1;
#else
        u16 rsvd : 1;
        u16 host_port_en : 1;
        u16 ip_type : 1;
        u16 vni_en : 1;
        u16 cnter_en : 1;
        u16 dport_en : 1;
        u16 sport_en : 1;
        u16 proto_en : 1;
        u16 dscp_en : 1;
        u16 host_ip_en : 1;
        u16 dip_en : 1;
        u16 sip_en : 1;
        u16 eth_type_en : 1;
        u16 vlan_en : 1;
        u16 dmac_en : 1;
        u16 smac_en : 1;
#endif
    } bs;
    u16 value;
} sml_ovs_pcap_mask_u;

typedef struct tag_sml_ovs_pcap_cfg_tbl {
#if (BYTE_ORDER == BIG_ENDIAN)
    sml_ovs_pcap_mask_u mask;
    u16 vport_id;
#else
    u16 vport_id;
    sml_ovs_pcap_mask_u mask;
#endif
    /* filter */
    sml_ovs_cap_dmac_smac_u dmac_smac;
    u32 sip;
    u32 dip;
    u32 host_ip;
    ip_mask_u sip_mask;
    ip_mask_u dip_mask;
    ip_mask_u host_mask;
#if (BYTE_ORDER == BIG_ENDIAN)
    u32 vlan_id : 16;
    u32 eth_type : 16;

    u32 dport : 16;
    u32 sport : 16; /* multiplex with host_port */

    u32 dscp : 8;
    u32 ip_proto : 8;
    u32 qid : 16;

    u32 vni : 24;
    u32 pf_id : 8;
#else
    u32 eth_type : 16;
    u32 vlan_id : 16;

    u32 sport : 16; /* multiplex with host_port */
    u32 dport : 16;

    u32 qid : 16;
    u32 ip_proto : 8;
    u32 dscp : 8;

    u32 pf_id : 8;
    u32 vni : 24;
#endif
    u64 counter;
} sml_ovs_pcap_cfg_tbl_s;

typedef struct tag_sml_ovs_etp_bitmap_info {
    u32 bitmap[2];
    u32 rsvd[2];
} sml_ovs_etp_bitmap_s;

typedef struct tag_sml_ovs_etp_filter_tbl_info {
#if (BYTE_ORDER == BIG_ENDIAN)
    u32 qid : 16;
    u32 vport_id : 16;

    u32 pf_id : 8;
    u32 vpn_etp_drop : 1;
    u32 hwc_etp_drop : 1;
    u32 etp_type : 3;
    u32 rsvd1 : 19;
#else
    u32 vport_id : 16;
    u32 qid : 16;

    u32 rsvd1 : 19;
    u32 etp_type : 3;
    u32 hwc_etp_drop : 1;
    u32 vpn_etp_drop : 1;
    u32 pf_id : 8;
#endif
    u32 hwc_etp_tpid[4];
    u32 vpn_etp_tpid[4];
    u32 rsvd[2];
    sml_ovs_etp_bitmap_s etp_bitmap; // in order to save memory, reused this entry, it's only valid in the first entry
} sml_ovs_etp_filter_tbl_s;

/* can't change, api struct export to evs */
typedef union tag_ovs_fm_thrd_en_bitmap {
    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u16 rsvd : 9;
        u16 thrd_icmp_latency_en : 1;
        u16 thrd_icmp_pkt_loss_en : 1;
        u16 thrd_tcp_latency_en : 1;
        u16 thrd_downtime_en : 1;
        u16 thrd_cnt_timeout_retrans_en : 1;
        u16 thrd_cnt_retrans_en : 1;
        u16 periodical_enable : 1;
#else
        u16 periodical_enable : 1;
        u16 thrd_cnt_retrans_en : 1;
        u16 thrd_cnt_timeout_retrans_en : 1;
        u16 thrd_downtime_en : 1;
        u16 thrd_tcp_latency_en : 1;
        u16 thrd_icmp_pkt_loss_en : 1;
        u16 thrd_icmp_latency_en : 1;
        u16 rsvd : 9;
#endif
    } bs;
    u16 value;
} ovs_fm_thrd_bitmap_u;

/* can't change, api struct export to evs, total 7*4 bytes */
typedef struct tag_ovs_fm_threshold {
#if (BYTE_ORDER == BIG_ENDIAN)
    u16 thrd_cnt_retrans; /* threshold for retransmission */
    ovs_fm_thrd_bitmap_u thrd_en_bitmap;

    u8 thrd_cnt_timeout_retrans; /* threshold for timeout-retransmission */
    u8 rsvd;
    u16 thrd_icmp_pkt_loss; /* threshold for icmp packet loss */
#else
    ovs_fm_thrd_bitmap_u thrd_en_bitmap;
    u16 thrd_cnt_retrans;

    u16 thrd_icmp_pkt_loss;
    u8 rsvd;
    u8 thrd_cnt_timeout_retrans;
#endif
    u32 thrd_downtime;     /* threshold for downtime report, uint: ms */
    u32 thrd_tcp_latency;  /* threshold for tcp latency, uint: us */
    u32 thrd_icmp_latency; /* threshold for icmp latency, unit: us */
    u32 rsvd2[2];
} ovs_fm_threshold_s;
/* can't change, api struct export to evs, total 2*4 bytes */
typedef struct tag_ovs_fm_rule1 {
#if (BYTE_ORDER == BIG_ENDIAN)
    u8 proto;       /* 0x1: ICMP, 0x6:TCP */
    u8 glb_rule_id; /* max 8 rules */
    u8 rule_id;     /* now support 0 & 1, max two rules one vport */
    u8 rsvd0 : 4;
    u8 ip_type : 1;         /* 1: ipv6, 0: ipv4 */
    u8 first_last_rule : 1; /* when add, 1 means first, others 0; when del, 1 means last, others 0. */
    u8 rule_enable : 2;     /* 2:del all, 1: add, 0: del */

    u16 vport_id; /* get by hovs_port_mgmt_add, hovs_port_mgmt_add_dynamic */
    u16 rsvd;
#else
    u8 rule_enable : 2;     /* 2:del all, 1: add, 0: del */
    u8 first_last_rule : 1; /* when add, 1 means first, others 0; when del, 1 means last, others 0. */
    u8 ip_type : 1;         /* 1: ipv6, 0: ipv4 */
    u8 rsvd0 : 4;
    u8 rule_id;     /* now support 0 & 1, max two rules one vport */
    u8 glb_rule_id; /* max 8 rules */
    u8 proto;       /* 0x1: ICMP, 0x6:TCP */

    u16 rsvd; /* get by hovs_port_mgmt_add, hovs_port_mgmt_add_dynamic */
    u16 vport_id;
#endif
} ovs_fm_rule1_s;
/* can't change, api struct export to evs, total 2*4 bytes */
typedef struct tag_ovs_fm_rule_port {
#if (BYTE_ORDER == BIG_ENDIAN)
    u16 port_src_end;
    u16 port_src_start;

    u16 port_dst_end;
    u16 port_dst_start;
#else
    u16 port_src_start;
    u16 port_src_end;

    u16 port_dst_start;
    u16 port_dst_end;
#endif
} ovs_fm_rule_port_s;

/* can't change, api struct export to evs, total 27*4 bytes */
typedef struct tag_ovs_fm_rule {
    ovs_fm_rule1_s fm_rule1;
    u32 ip_src_start[4]; /* when ipv4, ip_src_start[0] is valid */
    u32 ip_src_end[4];   /* when ipv4, ip_src_end[0] is valid */
    u32 ip_dst_start[4]; /* when ipv4, ip_dst_start[0] is valid */
    u32 ip_dst_end[4];   /* when ipv4, ip_dst_end[0] is valid */
    ovs_fm_rule_port_s fm_rule_port;
    ovs_fm_threshold_s fm_thrd;
} ovs_fm_rule_s;

/* rule hint accelarate rule filter */
typedef struct tag_rule_tbl_hint_dw {
#if (BYTE_ORDER == BIG_ENDIAN)
    u16 rule_tbl_hint_1;
    u16 rule_tbl_hint_0;
#else
    u16 rule_tbl_hint_0;
    u16 rule_tbl_hint_1;
#endif
} rule_tbl_hint_dw_s;

/* sml_ovs_fm_ctl_tbl_info_s use index 0 entry */
typedef struct tag_sml_ovs_fm_ctl_tbl_info {
    u32 period; /* unit is us */
#if (BYTE_ORDER == BIG_ENDIAN)
    u32 queue_id : 16;
    u32 pf_id : 16;
#else
    u32 pf_id : 16;
    u32 queue_id : 16;
#endif
    ovs_fm_threshold_s thrd;
    u32 rsvd[3];

    rule_tbl_hint_dw_s rule_tbl_hint_dw[4];
} sml_ovs_fm_ctl_tbl_info_s;

/* sml_ovs_fm_rule_tbl_info_s use index 1-8 entry */
typedef struct tag_sml_ovs_fm_rule_tbl_info {
    ovs_fm_rule1_s fm_rule1;
    u32 ip_src_start;
    u32 ip_src_end;
    u32 ip_dst_start;
    u32 ip_dst_end;
    ovs_fm_rule_port_s fm_rule_port;
    ovs_fm_threshold_s thrd;
#if (BYTE_ORDER == BIG_ENDIAN)
    u16 func_id;
    u16 rsvd;
#else
    u16 rsvd;
    u16 func_id;
#endif
} sml_ovs_fm_rule_tbl_info_s;

/*
 * Struct name:    sml_tapname_tbl_16_12_key_s
 * @brief          migration tap_name key
 * Description:    migration tap_name key define
 */
typedef struct tag_sml_tapname_tbl_16_12_key {
    u8 tap_name[16];
} sml_tapname_tbl_16_12_key_s;

/*
 * Struct name:    sml_tapname_tbl_16_12_item_s
 * @brief          migration tap_name item
 * Description:    migration tap_name define
 */
typedef struct tag_sml_tapname_tbl_16_12_item {
#if (BYTE_ORDER == BIG_ENDIAN)
    u32 rsvd1 : 16;
    u32 func_id : 16;
#else
    u32 func_id : 16;
    u32 rsvd1 : 16;
#endif
    u32 rsvd2;
    u32 rsvd3;
} sml_tapname_tbl_16_12_item_s;

typedef struct tag_ovs_vport_upcall_queue {
#if (BYTE_ORDER == BIG_ENDIAN)
    u16 pf_id : 3;     /* local pf_id */
    u16 queue_id : 13; /* global queue id */
#else
    u16 queue_id : 13;
    u16 pf_id : 3;
#endif
} ovs_vport_upcall_queue_s;

#define OVS_MAX_UPCALL_QUEUE_CNT 16
typedef struct tag_sml_ovs_vport_upcall_queue {
    ovs_vport_upcall_queue_s upcall_q[OVS_MAX_UPCALL_QUEUE_CNT];
} sml_ovs_vport_upcall_queue_s;

typedef struct tag_mig_lt_header {
    u32 log_buffer_size; /* dw0-total dirty size */
    u32 sge_len;         /* dw1-mig dirty block size */
    u32 err_cnt;         /* dw2-record err cnt for drive requirement */
    u32 rsvd;
} mig_lt_header_s;

typedef struct tag_sml_ipsec_spv4_key {
    u32 saddr;
    u32 daddr;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 sport : 16;
            u32 dport : 16;
#else
            u32 dport : 16;
            u32 sport : 16;
#endif
        } bs;
        u32 value;
    } key_dw2;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsvd : 24;
            u32 ulp_proto : 8;
#else
            u32 ulp_proto : 8;
            u32 rsvd : 24;
#endif
        } bs;
        u32 value;
    } key_dw3;

    u32 key_dw4;
    u32 key_dw5;
    u32 key_dw6;
    u32 key_dw7;
} sml_ipsec_spv4_key_s;

typedef struct tag_sml_ipsec_spv6_key {
    u32 saddr[4];
    u32 daddr[4];
} sml_ipsec_spv6_key_s;

typedef struct tag_sml_ht_ipsec_spd_32_20_key {
    union {
        sml_ipsec_spv4_key_s v4;
        sml_ipsec_spv6_key_s v6;
    } key;
} sml_ht_ipsec_spd_32_20_key_s;

typedef struct tag_sml_ht_ipsec_spd_32_20_item {
    u32 spi;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsvd : 10;
            u32 action : 5;
            u32 iptype : 1;
            u32 ulp_proto : 8;
            u32 ipsec_proto : 8;
#else
            u32 ipsec_proto : 8;
            u32 ulp_proto : 8;
            u32 iptype : 1;
            u32 action : 5;
            u32 rsvd : 10;
#endif
        } bs;

        u32 value;
    } item_dw1;
    u32 item_dw2;
    u32 item_dw3;
    u32 item_dw4;
} sml_ht_ipsec_spd_32_20_item_s;

typedef struct tag_sml_ht_ipsec_sad_32_20_key {
    u32 daddr[4];
    u32 spi;
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsvd : 24;
            u32 ipsec_proto : 8;
#else
            u32 ipsec_proto : 8;
            u32 rsvd : 24;
#endif
        } bs;
        u32 value;
    } key_dw5;
    u32 key_dw6;
    u32 key_dw7;
} sml_ht_ipsec_sad_32_20_key_s;

typedef struct tag_sml_ht_ipsec_sad_32_20_item {
    u32 exchange_id;
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 ulp : 16;         /* [31:16] */
            u32 auth_type : 4;    /* [15:12] */
            u32 enc_type : 4;     /* [11:8] */
            u32 alg_type : 2;     /* [7:6] */
            u32 alg_standard : 2; /* [5:4] */
            u32 dir : 2;          /* [3:2] */
            u32 iptype : 2;       /* [1:0] */
#else
            u32 iptype : 2;       /* [0:1] */
            u32 dir : 2;          /* [2:3] */
            u32 alg_standard : 2; /* [4:5] */
            u32 alg_type : 2;     /* [6:7] */
            u32 enc_type : 4;     /* [8:11] */
            u32 auth_type : 4;    /* [12:15] */
            u32 ulp : 16;         /* [16:31] */
#endif
        } bs;
        u32 value;
    } item_dw1;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsvd : 16;   /* [31:16] */
            u32 funcid : 16; /* [15:0] */
#else
            u32 funcid : 16;      /* [0:15] */
            u32 rsvd : 16;        /* [16:31] */
#endif
        } bs;
        u32 value;
    } item_dw2;

    u32 item_dw3;
    u32 item_dw4;
} sml_ht_ipsec_sad_32_20_item_s;

typedef struct tag_sml_flexq_mapping_tbl_8_4_key {
    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u32 func_id : 12;
        u32 local_qid : 16;
        u32 rsvd : 4;
#elif (BYTE_ORDER == LITTLE_ENDIAN)
        u32 rsvd : 4;
        u32 local_qid : 16;
        u32 func_id : 12;
#endif
    } dw0;

    u32 dw1;
} sml_flexq_map_tbl_8_4_key_s;

typedef struct tag_sml_flexq_tbl_8_4 {
    sml_mac_tbl_head_u head;
    sml_flexq_map_tbl_8_4_key_s key;
    u32 item;
} sml_flexq_tbl_8_4_s;

typedef struct tag_sml_ovs_etp_xtrace_info {
#if (BYTE_ORDER == BIG_ENDIAN)
    u32 pf_id       : 8;
    u32 qid         : 16;
    u32 proto       : 8;
#else
    u32 proto       : 8;
    u32 qid         : 16;
    u32 pf_id       : 8;
#endif

    u32 sip;
    u32 dip;
    u32 sip_mask;
    u32 dip_mask;

#if (BYTE_ORDER == BIG_ENDIAN)
    u32 sport_start : 16;
    u32 sport_end   : 16;
    u32 dport_start : 16;
    u32 dport_end   : 16;
#else
    u32 sport_end   : 16;
    u32 sport_start : 16;
    u32 dport_end   : 16;
    u32 dport_start : 16;
#endif

    u32 rsvd;
} sml_ovs_etp_xtrace_info_s;

/* safe gpa context Format start */
typedef struct tag_sml_vmsec_ctx_gpa_tbl {
    u32 gpa_addr0_hi;
    u32 gpa_addr0_lo;
    u32 gpa_len0;
    u32 rsvd;
} sml_vmsec_ctx_gpa_tbl_s;
/* safe gpa context Format end */

/* pci hole gpa context Format start */
typedef struct tag_sml_vmsec_pci_hole_gpa_tbl {
   /* pci hole 32-bit region */
    u32 gpa_addr0_hi;
    u32 gpa_addr0_lo;
    u32 gpa_len0_hi;
    u32 gpa_len0_lo;

    /* pci hole 64-bit region */
    u32 gpa_addr1_hi;
    u32 gpa_addr1_lo;
    u32 gpa_len1_hi;
    u32 gpa_len1_lo;

    u32 domain_id;
#if (BYTE_ORDER == BIG_ENDIAN)
    u32 rsvd    : 21;
    u32 vf_nums : 11;
#else
    u32 vf_nums : 11;
    u32 rsvd    : 21;
#endif
    u32 vroce_vf_bitmap;
    u32 rsvd1[5];
} sml_vmsec_pci_hole_gpa_tbl_s;
/* pci hole gpa context Format end */

typedef struct tag_sml_vroce_vf_tbl {
    u32 racl_id;
#if  (BYTE_ORDER == BIG_ENDIAN)
    u32 ctrl_pf_func_id    : 16;
    u32 vlan_id            : 12;
    u32 bond_id            : 4;

    u32 vni                : 24;
    u32 vni_en             : 8;

    u32 set_flags          : 8;
    u32 base_id            : 8;
    u32 host_id            : 8;
    u32 rsvd1              : 8;

    u32 func_id           : 12;
    u32 max_qp_num        : 20;

    u32 rsvd2             : 12;
    u32 max_srq_num       : 20;
#else
    u32 bond_id            : 4;
    u32 vlan_id            : 12;
    u32 ctrl_pf_func_id    : 16;

    u32 vni_en             : 8;
    u32 vni                : 24;

    u32 rsvd1              : 8;
    u32 host_id            : 8;
    u32 base_id            : 8;
    u32 set_flags          : 8;

    u32 max_qp_num        : 20;
    u32 func_id           : 12;

    u32 max_srq_num       : 20;
    u32 rsvd2             : 12;
#endif
    u32 master_feature;
    u32 slave_feature;
    u32 rsvd[8];
} sml_vroce_vf_tbl_s;

typedef struct tag_sml_glb_tbl_roce_cfg {
    u32 dw0;  /* vroce 已使用 */
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 cmtt_cl_start : 10;
            u32 cmtt_cl_end : 10;
            u32 cmtt_cl_size : 2;
            u32 rsvd : 10;
#else
            u32 rsvd : 10;
            u32 cmtt_cl_size : 2;
            u32 cmtt_cl_end : 10;
            u32 cmtt_cl_start : 10;
#endif
        }bs;
        u32 value;
    }dw1;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 dmtt_cl_start : 10;
            u32 dmtt_cl_end : 10;
            u32 dmtt_cl_size : 2;
            u32 rsvd : 10;
#else
            u32 rsvd : 10;
            u32 dmtt_cl_size : 2;
            u32 dmtt_cl_end : 10;
            u32 dmtt_cl_start : 10;
#endif
        }bs;
        u32 value;
    }dw2;

    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 wqe_cl_start : 10;
            u32 wqe_cl_end : 10;
            u32 wqe_cl_size : 2;
            u32 rsvd : 10;
#else
            u32 rsvd : 10;
            u32 wqe_cl_size : 2;
            u32 wqe_cl_end : 10;
            u32 wqe_cl_start : 10;
#endif
        }bs;
        u32 value;
    }dw3;

    u32 rsvd[12];   /* vroce 已使用0-10 */
} sml_glb_tbl_roce_cfg_s;

typedef struct tag_sml_glb_vroce {
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 vlan_id : 12;
            u32 rsvd : 20;
#else
            u32 rsvd : 20;
            u32 vlan_id : 12;
#endif
        } bs;
        u32 value;
    } dw0;

    u32 dw1;  /* roce 已使用 */
    u32 dw2;  /* roce 已使用 */
    u32 dw3;  /* roce 已使用 */
    union {
        struct {
#if (BYTE_ORDER == BIG_ENDIAN)
            u32 rsvd : 22;
            u32 icq_length_threshold : 10;
#else
            u32 icq_length_threshold : 10;
            u32 rsvd : 22;
#endif
        } bs;
        u32 value;
    } dw4;

    u32 vtep_ipv4;
    u32 vtep_ipv6[4];

#if (BYTE_ORDER == BIG_ENDIAN)
    u32 vtep_mac_h : 16;
    u32 vtep_mac_m : 16;

    u32 vtep_mac_l : 16;
    u32 default_gwmac_h : 16;

    u32 default_gwmac_m : 16;
    u32 default_gwmac_l : 16;

    u32 dscp_rc            : 8;
    u32 dscp_ud            : 8;
    u32 dscp_xrc           : 8;
    u32 rsvd1              : 8;

    u32 cos_num_rc         : 3;
    u32 cos_num_ud         : 3;
    u32 cos_num_xrc        : 3;
    u32 group_rc           : 3;
    u32 group_ud           : 3;
    u32 group_xrc          : 3;
    u32 rsvd2              : 14;
#else
    u32 vtep_mac_m : 16;
    u32 vtep_mac_h : 16;

    u32 default_gwmac_h : 16;
    u32 vtep_mac_l : 16;

    u32 default_gwmac_l : 16;
    u32 default_gwmac_m : 16;

    u32 rsvd1              : 8;
    u32 dscp_xrc           : 8;
    u32 dscp_ud            : 8;
    u32 dscp_rc            : 8;

    u32 rsvd2              : 14;
    u32 group_xrc          : 3;
    u32 group_ud           : 3;
    u32 group_rc           : 3;
    u32 cos_num_xrc        : 3;
    u32 cos_num_ud         : 3;
    u32 cos_num_rc         : 3;
#endif

    u32 rsvd;
} sml_glb_tbl_vroce_s;

typedef struct tag_sml_vroce_filter_tbl {
    u32 dst_qpn;
#if (BYTE_ORDER == BIG_ENDIAN)
    u32 sip_type : 1;
    u32 dip_type : 1;
    u32 rsvd0 : 30;
#else
    u32 rsvd0 : 30;
    u32 dip_type : 1;
    u32 sip_type : 1;
#endif
    u32 rsvd1;
    u32 sport;
    u32 opcode;
    u32 pos;
    u32 count;
    u32 set_flags;
} sml_vroce_filter_tbl_s;

typedef struct tag_sml_vroce_filter_ip_tbl {
    u32 sip[SML_IPV6_LEN];
    u32 dip[SML_IPV6_LEN];
} sml_vroce_filter_ip_tbl_s;

typedef struct tag_sml_ovs_mirror_vport_key {
#if (BYTE_ORDER == BIG_ENDIAN)
    u32 vport : 12;
    u32 session_id : 20;
#else
    u32 session_id : 20;
    u32 vport : 12;
#endif
} sml_ovs_mirror_vtep_key_s;

typedef struct tag_sml_ovs_mirror_vport_info {
#if (BYTE_ORDER == BIG_ENDIAN)
    u8 inner_dmac[6];
    u8 is_outer_ipv6;
    u8 rsvd0;
#elif (BYTE_ORDER == LITTLE_ENDIAN)
    u8 inner_dmac3;
    u8 inner_dmac2;
    u8 inner_dmac1;
    u8 inner_dmac0;
    u8 rsvd0;
    u8 is_outer_ipv6;
    u8 inner_dmac5;
    u8 inner_dmac4;
#endif
} sml_ovs_mirror_vtep_info_s;

typedef struct tag_sml_ovs_mirror_out_dip_info {
    u32 outer_dip[4];
} sml_ovs_mirror_out_dip_s;

typedef struct tag_sml_ovs_mirror_global_info {
#if (BYTE_ORDER == BIG_ENDIAN)
    u8 outer_dmac[6];
    u8 outer_smac[6];
    u32 outer_sip;
    u32 outer_sipv6[4];
    u16 outer_dport;
    u16 outer_vlan_id;
    u8 inner_smac[6];
    u8 outer_sip_vld;
    u8 outer_sipv6_vld;
#elif (BYTE_ORDER == LITTLE_ENDIAN)
    u8 outer_dmac3;
    u8 outer_dmac2;
    u8 outer_dmac1;
    u8 outer_dmac0;
    u8 outer_smac1;
    u8 outer_smac0;
    u8 outer_dmac5;
    u8 outer_dmac4;
    u8 outer_smac5;
    u8 outer_smac4;
    u8 outer_smac3;
    u8 outer_smac2;
    u32 outer_sip;
    u32 outer_sipv6[4];
    u16 outer_vlan_id;
    u16 outer_dport;
    u8 inner_smac3;
    u8 inner_smac2;
    u8 inner_smac1;
    u8 inner_smac0;
    u8 outer_sipv6_vld;
    u8 outer_sip_vld;
    u8 inner_smac5;
    u8 inner_smac4;
#endif
    u32 rsvd[1];  /* align to 48B */
} sml_ovs_mirror_global_info_s;

typedef struct tag_sml_ovs_mirror_session_info {
#if (BYTE_ORDER == BIG_ENDIAN)
    u16 enabled;
    u16 inner_dport;
    u16 mirror_len;
    u16 rsvd;
#elif (BYTE_ORDER == LITTLE_ENDIAN)
    u16 inner_dport;
    u16 enabled;
    u16 rsvd;
    u16 mirror_len;
#endif
    u32 inner_dip;
    u32 inner_vni;
} sml_ovs_mirror_session_info_s;

typedef struct tag_sml_ovs_mirror_session_table {
#if (BYTE_ORDER == BIG_ENDIAN)
    u32 enabled : 1;
    u32 session_id : 8;
    u32 is_vlan  : 1;
    u32 is_ipv4  : 1;
    u32 is_gre  : 1;
    u32 rsvd0 : 4;
    u32 dest_port : 16; /* mirror destination vf/bnond port id */

    u32 mirror_len : 8;
    u32 rsvd1 : 8;
    u32 vlan_tag : 16;

    u8 dmac[6];
    u8 smac[6];

    u32 sip[4];  /* when ipv4, sip[0] is valid */
    u32 dip[4];  /* when ipv4, dip[0] is valid */
    union {
        struct {
            u32 rsvd2 : 8;
            u32 vxlan_rsvd0 : 24; /* vxlan header rsvd0, network order */

            u32 vni : 24; /* Virtual network identifier, network order */
            u32 rsvd3 : 8;
        } vxlan;
        struct {
            u16 c_k_s_rsvd0_ver;
            u16 protocol;
        } gre;
    } tunnel;
#elif (BYTE_ORDER == LITTLE_ENDIAN)
    u32 dest_port : 16;
    u32 rsvd0 : 4;
    u32 is_gre  : 1;
    u32 is_ipv4  : 1;
    u32 is_vlan  : 1;
    u32 session_id : 8;
    u32 enabled : 1;

    u32 vlan_tag : 16;
    u32 rsvd1 : 8;
    u32 mirror_len : 8;

    u8 dmac3;
    u8 dmac2;
    u8 dmac1;
    u8 dmac0;
    u8 smac1;
    u8 smac0;
    u8 dmac5;
    u8 dmac4;
    u8 smac5;
    u8 smac4;
    u8 smac3;
    u8 smac2;

    u32 sip[4];  /* when ipv4, sip[0] is valid */
    u32 dip[4];  /* when ipv4, dip[0] is valid */
    union {
        struct {
            u32 vxlan_rsvd0 : 24; /* vxlan header rsvd0, network order */
            u32 rsvd2 : 8;

            u32 rsvd3 : 8;
            u32 vni : 24; /* Virtual network identifier, network order */
        } vxlan;
        struct {
            u16 protocol;
            u16 c_k_s_rsvd0_ver;
        } gre;
    } tunnel;
#endif

    u32 rsvd4; /* align to 64B */
} sml_ovs_mirror_session_table_s;

typedef struct tag_sml_ovs_mirror_tbl_16_36_key {
    u32 rsvd[3];
    u32 session_id;
} sml_ovs_mirror_tbl_16_36_key_s;

#define SML_FLOW_VERION_LOAD_SIZE 16
typedef struct tag_sml_ovs_flow_version_info {
    u16 version[SML_FLOW_VERION_LOAD_SIZE];
} sml_ovs_flow_version_info_s;

/**
 * Struct name:    sml_mac_tbl_16_12_key_u
 * @brief          Mac Table Key
 * Key of the Description: vroce MAC table.
 */
typedef union tag_sml_mac_tbl_16_12_key {
    struct {
        u32 dw0;
        u32 dw1;
        u32 dw2;
        u32 dw3;
    } value;

    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u32 er_id : 4;
        u32 vlan_vni : 24;
        u32 rvsd1 : 4;

        u32 mac_h16 : 16;
        u32 mac_m16 : 16;

        u32 mac_l16 : 16;
        u32 rvsd2 : 16;

        u32 rvsd3;
#elif (BYTE_ORDER == LITTLE_ENDIAN)
        u32 rvsd1 : 4;
        u32 vlan_vni : 24;
        u32 er_id : 4;

        u32 mac_m16 : 16;
        u32 mac_h16 : 16;

        u32 rvsd2 : 16;
        u32 mac_l16 : 16;

        u32 rvsd3;
#endif
    } bs;

    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u32 er_id : 4;
        u32 vlan_vni : 24;
        u32 rvsd0 : 4;

        u32 mac0 : 8;
        u32 mac1 : 8;
        u32 mac2 : 8;
        u32 mac3 : 8;

        u32 mac4 : 8;
        u32 mac5 : 8;
        u32 rvsd1 : 16;

        u32 rvsd4;
#elif (BYTE_ORDER == LITTLE_ENDIAN)
        u32 rvsd0 : 4;
        u32 vlan_vni : 24;
        u32 er_id : 4;

        u32 mac3 : 8;
        u32 mac2 : 8;
        u32 mac1 : 8;
        u32 mac0 : 8;

        u32 rvsd1 : 16;
        u32 mac5 : 8;
        u32 mac4 : 8;

        u32 rvsd4;
#endif
    } mac_bs;
} sml_mac_tbl_16_12_key_u;

/**
 * Struct name:    sml_mac_tbl_16_12_item_u
 * @brief          Mac Table Item
 * Description:    vroce MAC table
 */
typedef union tag_sml_mac_tbl_16_12_item {
    struct {
        u32 dw0;
        u32 dw1;
        u32 dw2;
    } value;

    struct {
#if (BYTE_ORDER == BIG_ENDIAN)
        u32 rsvd : 7;
        u32 single_ip_en : 1;
        u32 single_ip_srv_mode : 1;
        u32 host_id : 3;
        u32 fwd_type : 4;
        u32 fwd_id : 16;

        u32 rsvd1[2];
#elif (BYTE_ORDER == LITTLE_ENDIAN)
        u32 fwd_id : 16;
        u32 fwd_type : 4;
        u32 host_id : 3;
        u32 single_ip_srv_mode : 1;
        u32 single_ip_en : 1;
        u32 rsvd : 7;

        u32 rsvd1[2];
#endif
    } bs;
} sml_mac_tbl_16_12_item_u;

/**
 * Struct name:    sml_mac_tbl_key_item_s
 * @brief          Mac Table( 16 + 12 )
 * Description: vroce MAC table Key + Item
 */
typedef struct tag_sml_mac_tbl_16_12 {
    sml_mac_tbl_head_u head;
    sml_mac_tbl_16_12_key_u key;
    sml_mac_tbl_16_12_item_u item;
} sml_mac_tbl_16_12_s;

typedef struct tag_sml_mac_tbl_look_up_key_16 {
    sml_mac_tbl_head_u head;
    sml_mac_tbl_16_12_key_u key;
} sml_mac_tbl_look_up_key_16;

typedef struct tag_sml_mac_tbl_look_up_rsp_12 {
    sml_mac_tbl_head_u head;
    sml_mac_tbl_16_12_item_u item;
} sml_mac_tbl_look_up_rsp_12;

#endif /* L2_TABLE_H */
